Topic
  • 8 replies
  • Latest Post - ‏2013-11-07T08:23:04Z by ChrisGF
ChrisGF
ChrisGF
184 Posts

Pinned topic Running Scripts with Datapool in a group

‏2013-10-10T08:47:29Z |

Hi,

Is there a way to run those scripts from a faster which have datapools?

(in a way that all the elements in the datapool are runned)

Thank you,

Krisz

  • MrCoolK
    MrCoolK
    80 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-10T12:35:33Z  

    can you be more specific you question is unclear

  • ChrisGF
    ChrisGF
    184 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-10T13:40:05Z  
    • MrCoolK
    • ‏2013-10-10T12:35:33Z

    can you be more specific you question is unclear

    I have two scripts with datapools (one has 10 rows the other 14) and one script with no datapool.

    Since all are in the same folder (belong together) I would like to run them from a 4th script a master script.

    Is this possible?

    If yes how?

    Thank you,

    K

     

  • MrCoolK
    MrCoolK
    80 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-10T16:30:26Z  
    • ChrisGF
    • ‏2013-10-10T13:40:05Z

    I have two scripts with datapools (one has 10 rows the other 14) and one script with no datapool.

    Since all are in the same folder (belong together) I would like to run them from a 4th script a master script.

    Is this possible?

    If yes how?

    Thank you,

    K

     

    may be i didnt understand properly but cant you just use

    callScript("Script1");

    callScript("Script2");

     

    Do you want to add some error handling is that what you meant?

     

    Thanks

    Cool K

    Updated on 2013-10-11T12:21:22Z at 2013-10-11T12:21:22Z by MrCoolK
  • ChrisGF
    ChrisGF
    184 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-15T07:09:41Z  
    • MrCoolK
    • ‏2013-10-10T16:30:26Z

    may be i didnt understand properly but cant you just use

    callScript("Script1");

    callScript("Script2");

     

    Do you want to add some error handling is that what you meant?

     

    Thanks

    Cool K

    yes, till this point its clear.

    but what if Script 1 has a datapool (2000 elements) and Script 2 has no datapool? What happens if I run the script like you mentioned above?

     

    Or what if Script 2 has 1000 elements in the datapool and I would like to run both Scripts like you wrote

    callScript("Script1");

    callScript("Script2");

     from a master file but in a way taht just the first 10 elements are executed in Script 1 and the first 5 elements (from the datapool) are executed in Script 2 ??

    Thanks,

    K

     

  • MrCoolK
    MrCoolK
    80 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-15T13:35:12Z  
    • ChrisGF
    • ‏2013-10-15T07:09:41Z

    yes, till this point its clear.

    but what if Script 1 has a datapool (2000 elements) and Script 2 has no datapool? What happens if I run the script like you mentioned above?

     

    Or what if Script 2 has 1000 elements in the datapool and I would like to run both Scripts like you wrote

    callScript("Script1");

    callScript("Script2");

     from a master file but in a way taht just the first 10 elements are executed in Script 1 and the first 5 elements (from the datapool) are executed in Script 2 ??

    Thanks,

    K

     

    It all depends upon where you have used the datapool.

    If the datapool has looped the complete script then if datapool has nothing then it wont run else it will run

    Lets say if you have used the datapool in the middle of the script then the script will run no matter the data is in the datapool or not.

     

     

    let see you want to run 5 rows of datapool then you can do

     

    int i=0
    while(!dpDone())
            {
                
            String id=dpString("ID");    
            
            System.out.println("running line number"+i+" and running ID "+id);
            
            
            System.out.println("done line number"+i+"  "+id);
            
                if(I==5){
                System.exit(0);
                }
                i++;
            dpNext();
            }
          

    if the value of i==0 i.e. datapool is 5 it will exit

    You can implement the above code depending upon your requirement

    Thanks

    Cool K

  • ChrisGF
    ChrisGF
    184 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-16T05:58:52Z  
    • MrCoolK
    • ‏2013-10-15T13:35:12Z

    It all depends upon where you have used the datapool.

    If the datapool has looped the complete script then if datapool has nothing then it wont run else it will run

    Lets say if you have used the datapool in the middle of the script then the script will run no matter the data is in the datapool or not.

     

     

    let see you want to run 5 rows of datapool then you can do

     

    int i=0
    while(!dpDone())
            {
                
            String id=dpString("ID");    
            
            System.out.println("running line number"+i+" and running ID "+id);
            
            
            System.out.println("done line number"+i+"  "+id);
            
                if(I==5){
                System.exit(0);
                }
                i++;
            dpNext();
            }
          

    if the value of i==0 i.e. datapool is 5 it will exit

    You can implement the above code depending upon your requirement

    Thanks

    Cool K

    Pretty cool and clean solution, yes. I see. Thank you Cool K!

  • cagin.uludamar
    cagin.uludamar
    66 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-10-21T12:57:24Z  
    • MrCoolK
    • ‏2013-10-15T13:35:12Z

    It all depends upon where you have used the datapool.

    If the datapool has looped the complete script then if datapool has nothing then it wont run else it will run

    Lets say if you have used the datapool in the middle of the script then the script will run no matter the data is in the datapool or not.

     

     

    let see you want to run 5 rows of datapool then you can do

     

    int i=0
    while(!dpDone())
            {
                
            String id=dpString("ID");    
            
            System.out.println("running line number"+i+" and running ID "+id);
            
            
            System.out.println("done line number"+i+"  "+id);
            
                if(I==5){
                System.exit(0);
                }
                i++;
            dpNext();
            }
          

    if the value of i==0 i.e. datapool is 5 it will exit

    You can implement the above code depending upon your requirement

    Thanks

    Cool K

    AFAIR there is a callScript overload which accepts item count to process.

    So the code in master script can be:

    callScript(Script1);
    callScript(Script2, 5); //just process 5 records from dp
    callScript(Script3);

  • ChrisGF
    ChrisGF
    184 Posts

    Re: Running Scripts with Datapool in a group

    ‏2013-11-07T08:23:04Z  

    AFAIR there is a callScript overload which accepts item count to process.

    So the code in master script can be:

    callScript(Script1);
    callScript(Script2, 5); //just process 5 records from dp
    callScript(Script3);

    Great answer! Thank you for your suggestion!

    I'm going to use it in the future :-)

    Updated on 2013-11-07T08:23:19Z at 2013-11-07T08:23:19Z by ChrisGF