4 Replies Latest reply on Sep 7, 2010 8:45 AM by gchq_Again

    Looping through records... LC 8.0

    gchq_Again Level 1

      Hi there

       

      It seems easy enough to get the first record from a DB into a Form - but for the life of me I cannot find a way to loop through all the records (like mail merge) and enter all the records?

       

      Could someone please point me in the right direction?

       

      Thanks

        • 1. Re: Looping through records... LC 8.0
          pguerett Level 6

          Do you want to show all of the records at the same time (each record takes a row in a table)  ...or are you trying to cycle through each record one at a time (one page in the form showing one record at a time)?

           

          Paul

          • 2. Re: Looping through records... LC 8.0
            gchq_Again Level 1

            Hi Paul

             

            Thanks for responding...

             

             

            I need to cycle through x records on a Sybase back-end and enter some information from each record on a seperate page - rather like mail merge!

            • 3. Re: Looping through records... LC 8.0
              pguerett Level 6

              I assume that you are using an ODBC connection from the form to the DB. If so....

               

              then there are functions provided that will get the next, previous, first and last records.

               

              I have attached a sample that shows the code required.....note that you will not have the DB that I used but you shoudl be able to derive the technique from it.

               

              Paul

              • 4. Re: Looping through records... LC 8.0
                gchq_Again Level 1

                Hi Paul

                 

                That method would appear to be dependent upon a click method with buttons.

                 

                Apart from the fact that it is time consuming, I can get the end result using .NET and iTextSharp (or ActivePDF Toolkit in asp.NET) to produce 'bulk' pdf documents by loading everything into a DataTable and running through a For loop for each row in the DataTable.

                 

                These forms would be a 'one off' for each new Customer, with an average of 120 records, so was looking for a 'quick and dirty' approach - as you may gather we have LC but not used it very much at all, so perhaps I was missing something!