Forum Discussion

bdre's avatar
bdre
Occasional Contributor
7 years ago

Why doesn't this file datasource loop terminate?

This file datasource uses a text file that has 10 lines in it, each line is a phone number like 9495550000

The data loop as it is doesn't terminate.  What could be going wrong?

 

The screen shot shows the test case, as well as the data log for the data source with only the first two numbers.

 

  • HI,

     

    I've never seen a loop used that way - what's the purpose behind it?

     

    When you specify a datasource loop - you have to specify the target step and the datasource step.  Currently your target step is the same as your datasource step - typically the Target Step value is some sort of Request (REST/SOAP etc.) that uses the data from the datasource in some way -  so you point the loop's target step back to the request that uses the data - not the datasource step itself.

     

    If you stuck a REST request in between the datasource and the loop steps and specified the target step in the loop config as the REST request - this should execute as many times as the number of lines of data in your datasource file.

     

    Hope this helps,

     

    Cheers,

     

    richie

  • richie's avatar
    richie
    Community Hero

    HI,

     

    I've never seen a loop used that way - what's the purpose behind it?

     

    When you specify a datasource loop - you have to specify the target step and the datasource step.  Currently your target step is the same as your datasource step - typically the Target Step value is some sort of Request (REST/SOAP etc.) that uses the data from the datasource in some way -  so you point the loop's target step back to the request that uses the data - not the datasource step itself.

     

    If you stuck a REST request in between the datasource and the loop steps and specified the target step in the loop config as the REST request - this should execute as many times as the number of lines of data in your datasource file.

     

    Hope this helps,

     

    Cheers,

     

    richie

  • bdre's avatar
    bdre
    Occasional Contributor

    Yay!  Thanks richie.

     

    In my case (not shown in my question) there were several steps between the file data source and the REST call and the loop.  For a data source loop step in general, set DataSource Step to the data source step (fairly obvious), and the Target Step to the step after the data source step (not so obvious).  Thanks!