Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am solving the problem of reloading 2 tasks - the first task is reloading qvd and storing the number of rows into variable, the second task should have dependency on first and will reload after the first task was successfull.
The problem is that i am not able to make an intentional error in script that will cause task FAILED.
I tried something like this, the first if - task will end SUCCESSFUL
the else - task will end with ERROR:
if vNoofrowsReload > vRowsLast then
execute cmd.exe /c echo OK > OK.txt;
else
LOAD BLABLA from BLABLA;
endif;
Table BLABLA does not exist - the script will fail, but it is not wokring on the QV server. Can anbybody help me with the solution?
Thank you.
Not sure if I made myself clear, I was talking about TRACE statements to output the values of the variables, not the variable definitions.
TRACE vRowsLast: $(vRowsLast);
TRACE vNoofrowsReload: $(vNoofrowsReload);
Sorry my fault.
There is output of the 1st if (as I want):
2016-01-14 09:33:22 1261 TRACE vRowsLast = 288
2016-01-14 09:33:22 1261 vRowsLast = 288
2016-01-14 09:33:22 1262
2016-01-14 09:33:22 1262 TRACE vNoofrowsReload = 2885
2016-01-14 09:33:22 1262 vNoofrowsReload = 2885
There is output of the else - QV desktop shows the message that there is bad path to QVD. Then I click OK and the script run to the end. I think that this is not the behaviour that I want - I want to fail the whole qvw!? Any idea please?
2016-01-14 09:41:44 1245 NoOfRowsLast:
2016-01-14 09:41:44 1246 LOAD @1 as noofrowsLast
2016-01-14 09:41:44 1247 FROM
2016-01-14 09:41:44 1248 C:\\noofrowslast.txt
2016-01-14 09:41:44 1249 (txt, codepage is 1250, explicit labels, delimiter is ',', msq)
2016-01-14 09:41:44 1 fields found: noofrowsLast,
2016-01-14 09:41:44 1 lines fetched
2016-01-14 09:41:44 1251 execute cmd.exe /c echo 2885 > noofrowslast.txt
2016-01-14 09:41:44 1253 LET vRowsLast = Peek('noofrowsLast', 0, 'NoOfRowsLast')
2016-01-14 09:41:44 1255 if vNoofrowsReload > vRowsLast then
2016-01-14 09:41:44 1256
2016-01-14 09:41:44 1258 LOAD 'This is an error' from notexists.qvd(qvd)
2016-01-14 09:41:44 C:\\notexists.qvd' The system cannot find the file specified.
2016-01-14 09:41:44
2016-01-14 09:41:48 1259 endif
2016-01-14 09:41:48 1261 TRACE vRowsLast = 2885
2016-01-14 09:41:48 1261 vRowsLast = 2885
2016-01-14 09:41:48 1262
2016-01-14 09:41:48 1262 TRACE vNoofrowsReload = 2885
2016-01-14 09:41:48 1262 vNoofrowsReload = 2885
2016-01-14 09:42:01 Execution finished.
I must admit I am a little bit confused about your configurations and what you want to achieve.
If you want to force QV to enter error without user interaction, you can set error mode to 2 in the script (e.g. just before the LOAD with wrong path):
SET ErrorMode = 2;
I have one qvd generator that loads data every day, but not so reliable data source that data are as fresh as we want.
So we want to load the external txt file - this file will be made by user, if user thinks that data are not correct, user will throw TXT for QV to load and then we use it in text object for warning. But the problem is that our app is made on 1 sheet (objects use conditional show with variables), and if we reload many times per day - the user gets connection lost. That´s why i want to reload the first QVW every 10 minutes and have another binary load for next QVW that will reload only after the successful task(this qvw wil b presentation layer for users). So I need this else clause to FAIL the task and not to start the dependent task.
Is this more understandable?
Clicking the OK button when getting an error message during QV Desktop script execution will ignore the error and continue execution. Click Cancel if you want the script to fail in the ELSE branch.
On the server, scripts will be executed in batch mode and for ERRORMODE=1 you won't get a dialog. The default action will be to fail. If it does not work like that, there is something wrong with your script code.
Can you post the script instead of parts of log files?
Peter
Here is my script
LET vNoofrowsReload=NoOfRows('SalesQTY'); //actual load
NoOfRowsLast:
LOAD @1 as noofrowsLast
FROM
$(vPathTXT)noofrowslast.txt
(txt, codepage is 1250, explicit labels, delimiter is ',', msq); //load - nmber of rows from previous day, source table SalesQTY
execute cmd.exe /c echo $(vNoofrowsReload) > noofrowslast.txt;
LET vRowsLast = Peek('noofrowsLast', 0, 'NoOfRowsLast'); //number of rows from previous load
if vNoofrowsReload > vRowsLast then
execute cmd.exe /c echo OK > OK.txt; //SUCCESS task on QV server
else
//SET ErrorMode = 2;
LOAD 'This is an error' from notexists.qvd(qvd); //FAIL task on QV server - I dont know what to put here to fail the script every time when the if clause is no correct
endif;
Thank you.
Maros
We did the same thing on our environment, but we didn't encounter any issues on the server.
Can you please post your qvw script and which version of QV you are using?
Note: If you are using QV 12, then EXECUTE command won't work until you update the settings.ini file.
We test is on QV Server 11.20.12758.0
Here is the part of the qvw, I am not sure if this will help you.
NOTIFICATIONS_TASK_1x.qvw - Google Drive
Thank you!
Conclusion: This works on production server.
I dont know why, but on our server it does not work - I will mabye have to reinstall it.
Thank you everybody.