Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

Loop issue

Hi. I have a loop that try to reload table few times before fail or end loop if there is no fail.
But for some reason the script try to load table only once and the res of times just switch counter. 
Can someone explain why the script didn't work as expected?

Set ErrorMode = 0;
Set i= 0;

Do while i < 4

LOAD  Non_Exist_Field FROM Table.qvd (qvd);

Exit Do When ScriptErrorCount = 0;

Let i= i+ 1;

Loop

Set ErrorMode = 1;

Labels (1)
  • Loop

1 Solution

Accepted Solutions
Peony
Creator III
Creator III
Author

I find the reason that makes me doubt. At the load scree I see only amount of reloads via trace function.  And in the same time I see there that table load appeared only once. But in the debug mode I saw that everything fine. 🙂

Thank you for attention to my question. 

View solution in original post

4 Replies
lorenzoconforti
Specialist II
Specialist II

Not sure what the script is supposed to achieve but it works for me (i.e. the table is reloaded multiple times)

marcus_sommer

Pure syntactically your script is working but logically it makes not much sense to load the same data multiple times within the same table - without adding any sensible context, for example with rowno() or aggregating the data in any way, like a count() within a chart you won't see that the data are loaded several times.

I assume that your aim is to check if certain fields exists within a qvd or not. For this task it's IMO better not to load the data within a loop with the ERRORMODE else to use qvdnooffields() and qvdfieldname() to get the information from the meta-data of the qvd.

- Marcus

Peony
Creator III
Creator III
Author

I have several load tasks in my work that are connected by schedule through a web connector to the same web document -  task at the same time. Sometimes this causes some app to fail due to they cannot connect to this doc. This script is needed so that the task does not break off after the first fail and tries to reconnect several times.

Peony
Creator III
Creator III
Author

I find the reason that makes me doubt. At the load scree I see only amount of reloads via trace function.  And in the same time I see there that table load appeared only once. But in the debug mode I saw that everything fine. 🙂

Thank you for attention to my question.