Using Business Object on For Each loop

Hey All

 

I'm trying to build some code to run a for each loop from a form's command button.

 

I add the For Each activity in the visual script editor and then in the List / Business Object collection I select the Local Business Object but then i'm not allowed to select the form variable from Local BO. I cant seem to type type anything in either. Has anyone else tried this?

 

Thanks

Jas

Tagged:

Comments

  • It does not make sense to use the Local Business Object in a foreach loop. I am pretty certain it does not support the required interation interface. I imagine it is in the selection list in error.

     

    What is it you are trying to do?

  • Hi,

     

    Yes we have done this before, however we use a Code activity not the "Assign value(s)" visual script with-in the loop to do this.

     

    This then allows you to do something like...

     

    if (Local.memComments == null || Local.memComments == "")
        Local.memComments = ForEachActivity1.comments;
    else
        Local.memComments += "\r\n" + ForEachActivity1.comments;
    

     Within the iteration of the loop, where "ForEachActivity1" is the name you give to the For each loop visual script.

     

    Cheers,

    Bill

  • As I understand it, that is for using a List in the foreach activity. If you use a Business Object, you should reference that, I think.

     

    In any case, the Local 'Business Object' is not iterative in either event.

     


    Bill Tanner wrote:

    Hi,

     

    Yes we have done this before, however we use a Code activity not the "Assign value(s)" visual script with-in the loop to do this.

     

    This then allows you to do something like...

     

    if (Local.memComments == null || Local.memComments == "")
      Local.memComments = ForEachActivity1.comments;
    else
      Local.memComments += "\r\n" + ForEachActivity1.comments;
    

     Within the iteration of the loop, where "ForEachActivity1" is the name you give to the For each loop visual script.

     

    Cheers,

    Bill