Iterate – lists

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate – lists

  • Creator
    Topic
  • #51333
    Keith McLeod
    Participant

      Can a variable be used as the basis for a list iterate?  I have a need to create repeating segments from the result of a SQL query.  Other suggestions are welcome.

      I am making the assumption that the literation over a list gives you the index number of each element.  If I have 3 elements, the %l1 variable would take on the values 0, 1, and 2.  5 elements 0, 1, 2, 3, and 4.  Where the return of results may produce a variable length list, this is what lead me to the question of the basis being a variable…..

      Any thoughts are welcome including other creative alternatives….

    Viewing 3 reply threads
    • Author
      Replies
      • #69758
        James Cobane
        Participant

          Keith,

          You can treat/manipulate/reference the list iteration variable (%l1) the same as you do the group,segment,field iteration variables.

        • #69759
          Robert Kersemakers
          Participant

            Keith,

            Have a look at this thread https://usspvlclovertch2.infor.com/viewtopic.php?t=2213 with an example of a DO-WHILE loop. I think this is what you are looking for.

            You can’t use a variable as a basis for an Iteration, so you can’t iterate over a dynamic basis.

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

          • #69760
            Jim Kosloskey
            Participant

              The ability to use a variable as the list basis has been requested as an enhancement some time ago.

              Maybe we can get this in Cloverleaf 6.0???

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

            • #69761
              Robert Milfajt
              Participant

                Talk about freakish timing.  I just needed to do this today, and here it is on Clovertech.

                Robert, awsome soluton!!   😀

                Bob

                Robert Milfajt
                Northwestern Medicine
                Chicago, IL

            Viewing 3 reply threads
            • The forum ‘Cloverleaf’ is closed to new topics and replies.