Hi there, I have the following issue with a while loop and could not find an solution here in the forums: The loop should run 25 times to generate some data which is then later written to a MS SQL database. So far the loop works as expected. Now I should be able to add an additional condition which causes the loop to run only until this condition is met or 25 runs have been accomplished. The value of this condition (OK/NOK) is generated in the loop itself, based on the data generated. I tried to work with a context variable but am unable to use it in the loop. With the tJavaRow component the value for this condition is added to the context variable.
Could anyone please give me a hint of how to do this? Your help is very much appreciated. Regards, Felix
it seems that you are checking every row is that correct? it so, you will be relying on the last row to have the value that you expect. is that correct?
Not exactly, in fact the first row determines all the relevant Data (=basic data). Each row contains the actual salary values of an employee. The basic row will then be multiplied for budgeting and forecast reasons max. 25 times(=months) or less if an employee leaves before the end of the budgeting period. I was experimenting a little over the weekend and changed the job in the process a little. The loop is now a For-Loop. Now it is basically working with the exception that the context variable (= max. amount of loops) is always taken from the last employee. Therefore if the calculated number of loops is 25, the loop will run 25 times for all the employees. If the calculated number of loops is 6 then it will run 6 times per employee for all employees. Now my problem is, how can I assign the "To"-variable of the loop with the calculated value for the number of loops for every employee individually? The "To"-Value of the loop contains the variable "context.iterationCount", it's just the value of the context variable which is wrong. The loop should run for example like this: - 1. employee --> 25 times - 2. employee --> 25 times - 3. employee --> 4 times ==> This should result in a total number of rows of 54, with the actual setting it does it only 12 times - 1. employee --> 25 times - 2. employee --> 25 times - 3. employee --> 4 times - 4. employee --> 25 times ==> This should result in a total number of rows of 79, with the actual setting it does it 100 times Below you'll find the printscreen of the new job. In this example the total amount of rows written into the MS SQL DB should be 79 and not 100. Hope, you could give me a hint of how to make it work correctly. Regards, Felix