Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


jnimocks
2022-02-15T19:21:48Z
I am trying to get a while loop to work. I have a sql statement returning a 'X' until a record is found. How do I set-up a loop variable to check this value until it no longer equals 'X'.

Here is the query statement:
declare @SelDate1 int = JDE_PD_CUSTOM.dbo.udfGregorianDate(GETDATE());
Select TOP 1 'X'
from JDE920.SVM920.F986110 (nolock)
where jcenhv = 'PY920'
and jcfndfuf2 in ('R42565_GB0100A')
and JCUSER = 'SCHEDPY'
and JCJOBSTS <> 'D'
and JCSBMDATE = @SelDate1
order by JCSBMDATE, JCACTTIME desc

image.png
Sponsor
Forum information
Joey S
2022-02-22T19:30:54Z
can you get the sql query to output a "success"?

So, when X is found what does the output from that task look like? That would be step 1.

Step 2 could be you have two tasks, the query then a second task, maybe you write out the result, date, time, etc to a log or maybe you send an email or whatever

For task 2 to run you could setup a condition where if task #1 = success then Task #2 runs otherwise task 1 runs again.

We really need more information. Like when do you want this to run, every day or week or ten minutes? Either way, you could use a condition to determine if task #2 runs and task #2 could then end the job until it is scheduled to run again.

Optionally, and maybe better, would be to set your Flow so that your output drives what happens next
On Complete - Look at output, then do some thing like run again, go to another task, etc
image.png
Michael Fjellström
2022-03-24T13:32:11Z
Originally Posted by: jnimocks 

I am trying to get a while loop to work. I have a sql statement returning a 'X' until a record is found. How do I set-up a loop variable to check this value until it no longer equals 'X'.

Here is the query statement:
declare @SelDate1 int = JDE_PD_CUSTOM.dbo.udfGregorianDate(GETDATE());
Select TOP 1 'X'
from JDE920.SVM920.F986110 (nolock)
where jcenhv = 'PY920'
and jcfndfuf2 in ('R42565_GB0100A')
and JCUSER = 'SCHEDPY'
and JCJOBSTS <> 'D'
and JCSBMDATE = @SelDate1
order by JCSBMDATE, JCACTTIME desc

image.png



Hi,

Are you still having this issue? Did you try Joey's suggestion?

Scroll to Top