Iterate using the list option

Homepage Clovertech Forums Cloverleaf Iterate using the list option

Tagged: ,

  • Creator
    Topic
  • #115979
    Jon Blanchard
    Participant

    How do I use the ITERATE action using the List type?  It was never explained properly in training and so few of us use it that very little mention is made of it.   It must still work, otherwise the List type wouldn’t still be there.

    Thanks.

    Migration Consultant
    Coffee Regional Medical Center
    Eastern Time Zone

Viewing 0 reply threads
  • Author
    Replies
    • #115980
      Jim Kosloskey
      Participant

      Well on later releases, if you point the basis to a field that is indeed a Tcl list (like a temp variable). The ITERATE will work its way over that list. Unfortunately the counter value (%lx) has the value of the current pointed to element in the list not the value of its position in the list.

      What I have used the List ITERATE for is to work my way through a repeating element like a while statement. That allows me to exit the ITERATE when a condition is met by setting the value of the counter to greater than the maximum element in the list.

      So the basis would be something like ‘0 1’ using %l1 as the counter.

      Inside the ITERATE I would check for a condition which might indicate to end the iteration. When the condition is true I COPY = 2 to $%l1 and that causes the iteration to end. If it is false, I COPY =0 (zero) to %l1 causing the list ITERATE to continue.

      The above technique I cover in more depth in my Xlate ITERATE class (along with everything lese you need to know about the ITERATE and other Xlate related topics). It is no longer as necessary with the BREAK Action in later Cloverleaf releases.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10