JAVASCRIPT IN ADOBE (QR CODE) - need to sort the data that is returned from QR code
Ok so I do have a background (newbie) in progamming C++,Java and C#. I am using the QR code feature of Adobe Forms. Unfortunately, the default javascript does not sort the data the way I have my fields laid out. It seems to group like items. Here is the code that comes default with the QR code. How do I get it to sort the data in the QR code the way I need it?
/* Customize: */
function bMemberOf(strName, aStrNames)
{
for (var nMembIdx in aStrNames)
{
if (strName == aStrNames[nMembIdx])
return true;
}
return false;
}
function strTabDelimited(oParam)
{
var bNeedTab = false;
var strNames = "";
var strValues = "";
for (var i = 0; i < oParam.oDoc.numFields; ++i)
{
var strFieldName = oParam.oDoc.getNthFieldName(i);
if ((null == oParam.aFields || bMemberOf(strFieldName, oParam.aFields))
&& (null == oParam.strXclField || strFieldName != oParam.strXclField)
&& (oParam.oDoc.getField(strFieldName).type != "button"))
{
if (bNeedTab)
{
if (oParam.bFieldNames)
strNames += "\n";
strValues += "\n";
}
if (oParam.bFieldNames)
strNames += strFieldName;
strValues += oParam.oDoc.getField(strFieldName).value;
bNeedTab = true;
}
}
if (oParam.bFieldNames)
return strNames + "/n" + strValues;
else
return strValues;
}
try
{
if ( app.viewerVersion >= ADBE.PMD_Need_Version )
event.value = strTabDelimited({oDoc: this, aFields:
[
"Driver1"
"JobNumber1",
"JobName1",
"Driver2",
"JobNumber2",
"JobName2"
]
, bFieldNames: false});
else event.value = " ";
}
catch (e)
{
event.value = " ";
}
do you know?
how many words do you know
See also questions close to this topic
-
how to change prettier format for react native
my code formatting prettier didn't works well for react native, i don't understand where to config it but it works well with flutter
from this code
import { View, Text } from 'react-native' import React from 'react' export default function App() { return ( <View> <Text>Apps</Text> </View> ) }
it's formatted to this
import { View, Text } from 'react-native' import React from 'react' export default function App() { return ( < View > < Text > Apps < /Text> < /View> ) }
-
MarkLogic server-side JavaScript and XQuery
I am just starting using NoSQL MarkLogic DB and trying to choose for me the best query language to learn and use in future. On server side MarkLogic provides the possibility to use JavaScript API or XQuery API.
I want to receive an advice. Which language is better to concentrate on and learn? JavaScript or XQuery?
- Popover in chrome extension using js
-
Convert 2D meshgrid into a 3D array in Python
I have coordinates (lat, lon) in a meshgrid, and data asociated with each "point". I want to export into a .csv and have each point asociated with the data i want to analyze. So far, my code looks like this.
xx1,yy1=np.meshgrid(xx,yy) row_format = np.stack([z.ravel() for z in (xx1, yy1, data['Hs'])], axis=1) print(row_format) pd.DataFrame(row_format).to_csv('sample.csv')
The data is in a dataframe that has a certain order. But the output is as follows:
x y Hs 265 19 0 266 19 1 267 19 2 And it should be as follows, in order to make sense with the data order:
x y Hs 265 19 0 265 18 1 265 17 2 I only need to make the "x" column to be the one with the "still" value while the "y" column goes through its values ("x" will change value once every "y" value has been written). Anyone know how to change that order? Or another way to get my desired output?
-
Range Not Found, Google Apps Script for Google Sheets
I'm trying to build a custom range for this sort function in an Apps Script for Google Sheets but I keep getting the error: "Exception: Range not found; sortProductionLog @ macros.gs:15"
I'm sure this is something basic but I have searched far and wide and can't seem to find it. Can anyone shed some light?
Thank you, Ryan
SORT_ORDER = [ {column: 118, ascending: true}, // 3 = column number, sorting by descending order {column: 119, ascending: true}, // 1 = column number, sort by ascending order {column: 117, ascending: true}, {column: 25, ascending: true} ]; function sortProductionLog(){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName(SHEET_NAME); var LastRow_WithValue = sheet.getLastRow(); var LastColumn_WithValue = sheet.getLastColumn(); var buildRange = "4,1," + (LastRow_WithValue - 4) + "," + (LastColumn_WithValue - 1); var range = sheet.getRange(buildRange); ss.toast(buildRange); range.sort }
-
Categorize similar transactions
Given a list of transactions, some transactions are categorized, some transactions are not categorized. Find similar transactions and categorize them if possible. Similar transactions have the same targetAccount and the amount difference is not greater than 1000 (for all currencies) from the originally categorized transaction. If an uncategorized transaction is similar to more than one transaction, it should take the category from the one with the smallest amount difference. Transactions that cannot be categorized should still be included in the returned list. The returned list should preserve the order of the original list.
categorizeSimilarTransactions(transactions)
Input You can assume that the transactions parameter will always be present and valid. list of transactions (Transaction[])
Output List of transactions(Transaction[]) with enhanced categorization if possible.
This is what a categorized transaction looks like:
{ id: "bfd6a11a-2099-4b69-a7bb-572d8436cf73", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -350, currency: "EUR", category: "eating_out", time: "2021-03-12T12:34:00Z" }
An uncategorized transaction does not have category property. This is what an uncategorized transaction looks like:
{ id: "0f0ffbf9-2e26-4f5a-a6c0-fcbd504002f8", sourceAccount: "my_account", targetAccount: "eating_out", amount: -1900, time: "2021-03-12T12:34:00Z" }
The following two transactions are similar:
{ id: "bfd6a11a-2099-4b69-a7bb-572d8436cf73", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -350, category: "eating_out", time: "2021-03-12T12:34:00Z" }
and
{ id: "a001bb66-6f4c-48bf-8ae0-f73453aa8dd5", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -620, time: "2021-04-10T10:30:00Z" }
Input
categorizeSimilarTransactions([ { id: "a001bb66-6f4c-48bf-8ae0-f73453aa8dd5", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: 350, time: "2021-04-10T10:30:00Z", }, { id: "bfd6a11a-2099-4b69-a7bb-572d8436cf73", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -150, category: "eating_out", time: "2021-03-12T12:34:00Z", }, { id: "6359091e-1187-471f-a2aa-81bd2647210f", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: 100, category: "entertainment", time: "2021-01-12T08:23:00Z", }, { id: "a8170ced-1c5f-432c-bb7d-867589a9d4b8", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -1690, time: "2021-04-12T08:20:00Z", }, ]);
Expected Output
[ { id: "a001bb66-6f4c-48bf-8ae0-f73453aa8dd5", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: 350, category: "entertainment", time: "2021-04-10T10:30:00Z", }, { id: "bfd6a11a-2099-4b69-a7bb-572d8436cf73", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -150, category: "eating_out", time: "2021-03-12T12:34:00Z", }, { id: "6359091e-1187-471f-a2aa-81bd2647210f", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: 100, category: "entertainment", time: "2021-01-12T08:23:00Z", }, { id: "a8170ced-1c5f-432c-bb7d-867589a9d4b8", sourceAccount: "my_account", targetAccount: "coffee_shop", amount: -1690, time: "2021-04-12T08:20:00Z", }, ];
I could find a solution but it's a brute-force approach & not efficient. Is there any other solution with less time complexity may be O(n) or O(log(n))/O(nlog(n)) which is easy to read & understand
const categorizeSimilarTransactions = (transactions) => { if (!(Array.isArray(transactions) && transactions.length)) return []; const categorizedTransactions = transactions.filter(t => t.category); const uncategorizedTransactions = transactions.filter(t => !t.category); let lowestDiff; uncategorizedTransactions.forEach(uncategorizedTransaction => { lowestDiff = Math.min(); categorizedTransactions.forEach(cat => { if (cat.targetAccount === uncategorizedTransaction.targetAccount) { lowestDiffComp = Math.abs(cat.amount - uncategorizedTransaction.amount); if (lowestDiffComp < lowestDiff && lowestDiffComp < 1000) { lowestDiff = lowestDiffComp; uncategorizedTransaction.category = cat.category; } } }) }); const merged = [...categorizedTransactions, ...uncategorizedTransactions]; const orderIds = transactions.map(transaction => transaction.id); merged.sort((a, b) => { return orderIds.indexOf(a.id) - orderIds.indexOf(b.id); }) return merged; };
-
I am using adobe after effect 2015 and I got a black screen in mocha ae after importing MP4 file. I have set the both FPS and resolution as same. Why?
I am using adobe after effect 2015 and when I import MP4 file into the mocha AE it gets black. I set the video and composition FPS as same as well as the resolution and i am using I3 5gen computer and on board GPU. Can u tell what is the reason for that.
-
SVG file imported as Vector in Android Studio not converted correctly
I have an image of a dinosaur that I have converted to an SVG from Adobe Illustrator (I did not create this image which may result to may lack of knowledge on what the issue is).
^ [Image is in PNG format because SVG cannot be uploaded, but both formats look identical]
However, whenever I upload this image into Android Studio using the "Configure Vector Asset" tool in the "Resource Manager" most of the image is transparent.
^ [As you can see most of the image is transparent]
I have done extensive research on how to resolve the issue; however, I have not been able to resolve the issue. Although, I believe I have pin pointed the issue which is due to the fact that "The tool supports group elements for translation, scaling, and rotation. Groups do not support an opacity property" (from https://developer.android.com/studio/write/vector-asset-studio#svg).
Unfortunately, even though I may be aware of what the problem is, I am unaware how to solve this issue. Any help would be greatly appreciated. Thank you.
-
Adobe Pdf - Hiding buttons on PNG export
Good Day, I'm creating a form in Adobe and need to use the form exported as an image. However, when exporting, the buttons appear in the output image. I was wondering if there is a way to hide the buttons when exporting the from as an PNG image. Cheers
-
PYZBAR how to get certain outputs from DECODE function
I'm using python PYZBAR to decode QR code captured by real time cam.
decode(input_frame)
Naturally the output I get is as follows
[Decoded(data=b'DATA', type='QRCODE', rect=Rect(left=50, top=179, width=255, height=254), polygon=[Point(x=50, y=433), Point(x=305, y=424), Point(x=302, y=180), Point(x=51, y=179)], quality=1, orientation='UP')]
the output shows:
- The data stored in the QR Code.
- Code type (QRCODE).
- The position of each corner of the QR Code in the frame.
- Quality.
- And the orientation of the QR Code (whether it up, down, left or right).
I'm only concerned about the data stored in the QR Code and its Orientation
How can I define them as a variable to use them later, something like the following pseudo code:
x = orientation y = data stored in QR Code if x == up && y == DATA: ...........
My goal is to read and decode QR Code data and orientation to navigate a robot like the video provided in the link.
-
Flutter qr_code_scanner camera doesn't open when i click a textfield inside of dialog
I using qr_code_scanner for scan a qr code & barcodes. Its scanning perfectly. But when i want to use dialog after scan for ask how much product did you scan and after that check it and control it.But when i use textfield inside of dialog and when i tap textfield camera stops working and its stays in black screen. What should i do ? What is wrong ? My codes for scan :
void _onQRViewCreated(QRViewController controller) { this.controller = controller; controller.scannedDataStream.listen((scanData) { controller.pauseCamera(); player.play("scanner_sound.mp3"); inspect(args); if (args.Barcode == scanData.code) { showDialog( context: context, builder: (context) { return WillPopScope( onWillPop: () async { Navigator.pop(context); controller.resumeCamera(); return true; }, child: AlertDialog( title: const Text('Ürün Giriş'), content: Column( children: [ const Text('Bu üründen kaç adet okutuldu ?'), TextField( keyboardType: TextInputType.number, controller: _controller, ), ], ), actions: <Widget>[ TextButton( onPressed: () { bool isTrue = checkScannedCount(int.parse(_controller.text)); if (isTrue) { var model = args.copyWith(ScannedCount: args.Count); context.read<ProductCubit>().updateProduct(model); Navigator.pop(context); Navigator.pop(context); } else { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text("Lütfen sayımı tekrarlayınız."), ), ); Navigator.pop(context); controller.resumeCamera(); //Its not starting camera again. } }, child: const Text('Tamam')), ], ), ); }); } else { showDialog( context: context, builder: (context) { return WillPopScope( onWillPop: () async { Navigator.pop(context); controller.resumeCamera(); return true; }, child: AlertDialog( title: const Text('Hatalı Barkod veya Ürün'), content: const Text('Yanlış ürünü veya barkodu okutuyor olabilirsiniz. Kontrol edip tekrar ediniz.'), actions: <Widget>[ TextButton( onPressed: () { Navigator.pop(context); controller.resumeCamera(); }, child: const Text('Tamam')), ], ), ); }); } }); }
-
pyserial read qr code and take action on arduino
I'm reading qr code using opencv and pyzbar, i'm communicating with an arduino uno using pyserial.
my python code
from pyzbar.pyzbar import decode import cv2 import serial import time arduino = serial.Serial(port='COM6', baudrate=115200, timeout=1) def write_read(x): arduino.write(bytes(x, 'utf-8')) time.sleep(0.05) data = arduino.readline() return data cap = cv2.VideoCapture(0) def get_qr_data(input_frame): try: return decode(input_frame) except: return [] while True: _, frame = cap.read() qr_obj = get_qr_data(frame) cv2.imshow("DD", frame) print(qr_obj) # cv2.imshow("DD2", frame2) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()
from
qr_obj = get_qr_data(frame)
i get the result[Decoded(data='asd', type='QRCODE', rect=Rect(left=115, top=155, width=225, height=223), polygon=[Point(x=115, y=378), Point(x=340, y=370), Point(x=335, y=155), Point(x=119, y=155)], quality=1, orientation='UP')]
im trying to print the qr data in arduino serial monitor and turn on the arduino built in led
my arduino code
char x; void setup() { Serial.begin(115200); Serial.setTimeout(1); pinMode(LED_BUILTIN, OUTPUT); } void loop() { while (!Serial.available()); x = Serial.read(); Serial.println(x); if(Serial.read() == x) { digitalWrite(LED_BUILTIN, HIGH); } }
The built in led doesn't turn on and nothing is written in the serial monitor