2 Replies Latest reply on Aug 19, 2014 7:45 AM by WF7A

    Need an easy way to parse records

    WF7A

      Title

      Need an easy way to parse records

      Post

           I have a file with each record having 40 fields and there are 300 records. What I want to to do is parse them out so each field has its own record so I'll end up with 12,000 records. I know I'll need a looping script of some kind but at first blush I can't see an easy way of having the loop hop from field-to-field in each record then, after the last field in the record, go to the next record then start the process again.


           Any ideas? TIA for your help!

        • 1. Re: Need an easy way to parse records
          philmodjunk

               Show All Records
               Go to Record/Request/Page [First]
               Set Variable [$FieldList ; value: FieldNames ( Get ( FileName ) ; "YourLayoutNameHere" ) ]
               Loop
                   Set Variable [$K ; value: 0 ]
                   Loop
                       Set Variable [$K ; value: $K + 1 ]
                       Exit Loop If [ $K > ValueCount ( $FieldList ) ]
                       Set Variable [$Value ; value: GetField ( GetValue ( $FieldList ; $K ) ) ]
                       Go To layout ["LayoutForNewTable" (NewTable) ]
                       New Record/Request
                       Set Field [NewTable::Field ; $Value ]
                       Go to Layout [Original Layout]
                    End Loop
                    Go to record/request/page [next ; exit after last]
               End Loop

          • 2. Re: Need an easy way to parse records
            WF7A

                 Wow, that _is_ easy! Thanks!