I'm trying to send, in one request, a get, a label to print, then another get.
1) Is this possible?
2) If so, what is the syntax?
Closest I've come so far is the following:
! U1 getvar "odometer.total_label_count"\n^XA Label Goes Here ^XZ\n! U1 getvar "odometer.total_label_count"
To clarify: I need to get the label count, print the label, then get the updated label count in one request. The code I have just returns the same count twice.
Am I just missing something or is this just not possible?
The problem is that the label is getting queued to be printed. While it is getting printed your second SGD is processed. You would need to add a delay to do this.
You could register for the print job completed alert and then have that trigger your follow up odometer check.
Related
I have a predicate check(Data,Res) that checksDats according to some rules and returns Res (a function result on Data, assuming Data answers to several criteria).
I have another function generate(N,Data) which generates a N-size Data.
My main program begins with generating many 1-size Data, then if none answered the criteria, we go on to 2-size Data and so on until we reach a certain M upper limit.
main(M):- next_number(N,M), generate(N,Data), check(Data,Res).
However, the program runs for very long time. I wanted to make sure it does not get stuck. For this, I wanted to print the generated Data each time before its being checked. But adding display did not assist, because it only actually displayed if the entire statement was true.
That's not what I want.
I want to keep track of the progran using display, similarly to System.out.println in Java.
Is there any other function that displays anyway? Or an idea how to use display in a way that will always display, regardless if the Data answered the criteria or not?
I thought to do:
(check(Data,Res) -> display(Data);display(Data)).
But I am not sure. Any ideas?
Your long process is likely to be within check - or more precisely, that check fails for most data, causing the system to backtrack repeatedly.
If you display a result in check, you'll have line upon line of tracing. Instead, you could add a write statement to generate, or even to your number generation:
main(M):-
next_number_and_tick(N,M),
generate(N,Data),
check(Data,Res).
next_number_and_tick(N,M) :-
next_number(N,M),
write('Tick - now doing '),
writeln(N).
Upon backtracking, the program will signal the data size it is now working on, giving you an idea of the volume of work it is doing.
The problem in the way you use display is that the entire statement must be true for it to display. Your idea of using "if-then" is good but not accurate. If you want to use it, you should "trick" prolog the following way:
new_check(Data,Res) :- (check(Data,Res) -> display('Victory!'),!; display('Failed Data: '), display(Data), nl, fail).
This way, if the check fails, you will get a report on which Data failed, and if it succeeded everything stops (assuming you want only 1 solution. If you want more, remoce the ! predicate).
I have like a POS application where I work, and I added new code to read barcodes in a datawindow, but been having some problems to use it correctly. The process needs to read the barcode and automatically search for the product, and insert it in another datawindow with the info regarding the product.
The problem is that I have the code in the editchanged event, and that the barcodes have different lenght; so, every time a number of the barcode is read, the search function is called, here is the code for that function:
ll_rtn = dw_search.Retrieve()
If ll_rtn = 1 Then
is_code = dw_search.GetItemString(1,'barcode')
wf_insert(False)
End If
If for example, a product of 10 digits is read and at length 5 the product is found, it's inserted but the editchanged is still running because the barcode is length 10, and depends of the search, might find it again with the last digits and insert it again.
I don't know how to stop reading after I find the product. Hope I explain it right.
Can you check if the barcode scanner can be configured to pass carriage return / Enter, upon scanning the barcode and this way you can move your code to itemchanged event
Bar Code Config
An editchanged event is fired for each keystroke in the control. You probably want to either move the code to the itemchanged event or to a totally separate event which is posted from the itemchanged event.
If you absolutely have to have the code in the editchanged event you need to set a boolean instance variable on the window which is set TRUE once the product is found. If it's true then don't search. Remember to reset the variable to FALSE prior to any new search.
I have a job in which I use a rowFilter based on a condition. It works. But, what I want to do more is to display an error or stop the job if the number of filtered rows is 0. How can I achieve that?
This is my job:
Does anyone could help me?
Thank you in advance!
You need to use "RunIf" trigger and put the condition that you want here so that the job process would determine it's running course based on it.
On your case it would be something like -
((Integer)globalMap.get("tFilterRow_1_NB_LINE_OK"))>0
tFilterRow_1_NB_LINE_OK is a global variable part of the tFilterRow component which says "Number of lines matching the filter".
If you want to catch the error and print out the details you could connect the "RunIf" to tDie component and then use tLogCatcher component to catch the error - make sure that you have selected the "Catch tDie" option.
I'm stuck on an error in my App Inventor 2 application. I' m using three checkboxes, so the user to pass values to a timer interval in a clock component.
The values are stored in a variable as a list of three values of miliseconds (e.g. 1600, 1800, 2000). I check in code when and which checkbox is checked and then pass it over to a TinyDB database as a tag.
Problem is that, in Do it and on the device running the app, I get the following error as title suggests.
Here is the coding blocks I've used so far:
Does anyone be kind enough to direct me to how solving this error? Is it possible to pass values to a clock component through this logic. I've used a listPicker with success sometime ago, but I need it done with a checkBoxes layout. Thank you all in advance for your answers.
[Edit1]
To overcome this error and before #Taifun's remarks and suggestions, I followed the variable path, to pass values in the timer interval field. Do not now if it is very efficient but it is working for now. Here is the coding blocks:
Bracket pairs like this () represent a list.
The operation TimerInterval cannot accept the arguments: [(1800)]
This is, what the error message is trying to tell you: You are trying to assign a list, which has the item 1800 inside, to the TimerInterval property of a clock component.
You should assign the value directly instead.
Also you should think about the default value: which value should be used, if the user did not store anything in TinyDB... You are currently using an empty string in the valueIfTagNotThere socket... This does not really make sense... A better value would be for example 1000 ... same for the else part in your if-then-else statement...
I have a while controller that waits for a certain regular expression to appear in the response before logging the user out. However, due to timeouts with the previous request this will occasionally enter into an infinite loop, skewing the data. I'm looking to set this request so that it only sends 5 times before exiting the loop and logging the user out.
After searching for an answer it seems that either the ${__counter()} variable or Counter Config Element are the solution, but neither seem to be working as I would expect.
Here is what I've got so far:
While Controller (${__javaScript( "${DONE_A}" != "Thank you for your order" || ${counter} < 5;)}
Counter (set to 5, increment 1)
Constant Timer (2000 ms)
GET /checkout/confirmation
^RegExp Extractor (DONE)
Logout
I can see a couple of problems with your script:
During 1st iteration counter value is NaN, you need to either declare it via i.e. User Defined Variables or to add check for "Not a Number" into your condition
You cannot refer variables as ${counter} in __JavaScript function. If you need to address it, you need to surround the variable with quotation marks (like you do for your DONE_A variable. If you need to treat the variable like a numeric one - use i.e. parseInt() function
Given point 2, my expectation is what your While controller clause simply does not work, that's why you're getting an endless loop.
This one should be good for your scenario:
${__javaScript(isNaN(parseInt("${counter}")) || parseInt("${counter}") < 5 && "${DONE_A}" != "Thank you for your order",)}