You are viewing limited content. For full access, please sign in.

Question

Question

Query Data in Repeat Loop unavailable after repeat

asked on February 9, 2018

We have a workflow that query's a spreadsheet ODBC connection for data.  The issue is that on occasion the lookup will fail and terminate the workflow.  This happens because either multiple workflows are trying to connect to that spreadsheet or the less likely reason that someone may have the sheet open to edit it.  We are trying to think of a good way to make it retry the query data without killing the workflow. 

I can always put in a try catch with Query Data on the Try Branch and a delay on the Catch branch.  To make it do the lookup again, without creating a second query data step is to put the Try-Catch in a repeat look that repeats until the Query Data step has results found. 

The issue with putting the Try-Catch in a Repeat loop is that once I do that the For Each Row activity below the repeat loop now says it can't access the Query Data array.  Here is a screen shot of my workflow steps. 

 

Before it comes up, yes a SQL table would be better for this usage but not as easy for the end user to edit when changes are needed.  Also, they haven't implemented Forms yet so we could build a nice web interface for them to edit and add data to the SQL table. 

0 0

Replies

replied on February 9, 2018

Have you tried taking it out of the try-catch and just making it a condition decision?

Within the repeat have a token value that will trigger the repeat action.  Query the data.  A conditional decision says if results were found do nothing and move forward.  No results found would change the trigger value to true and add the delay.  If you set the repeat to evaluate after it runs that should trigger it to search again.

You would have to play with it and see if it actually comes back as zero results found if the call fails because it can't access the spreadsheet versus no results because it got into the spreadsheet and didn't find anything.

RepeatTrigger.jpg
1 0
replied on February 9, 2018

I had tried that and it seems any time I put the Query Data activity in a repeat before the data is needed I get the same issue.  Here is a view of it with the error from the step that needs the data. 

 

Also, when I try to choose a different activity for the For Each Row activity I get the following.  Even though the Query Data activity is above this activity in the workflow.

0 0
replied on February 9, 2018

Tokens generated inside a loop go out of scope once the loop completes.

 

 

0 0
replied on February 9, 2018

Thanks Maruna, that makes sense.  Do you have any suggestions on how to get the workflow to try the query data activity a few times at least before terminating the workflow?

0 0
replied on February 9, 2018 Show version history

I could also just put the For Each Row activity in the repeat I assume?

 

0 0
replied on February 9, 2018

You can put the For Each Row in the Repeat.

I would try adding the error to the task error handler though and not using the Try-Catch/Repeat combo.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.