4 Replies Latest reply on Jun 13, 2018 5:34 PM by Mohammad Rehman

    How can I build a simple table walk to combine table data and other data

    Rick Westbrock

      I need some help with a complex push fields action that needs to combine character fields from a display-only form and and integer fields from an AL table walk of a table on that form to push into another regular form. The only way I can think of (shown below) requires replicating all the columns from the table on the display-only form.

       

      ConfigForm is a regular form that holds configuration data in Integer1 field

      TargetForm is a regular form that holds transactional data

       

      DisplayForm is display-only and has the following fields:

      * ConfigTable showing rows from ConfigForm

      * CharacterField

      * Integer1

      * Button

       

      Button triggers the ActiveLink-btn AL which in turn calls the ALGuide guide to loop ConfigTable

       

      ALGuide contains two active links:

      * ActiveLink-Pull which does a set fields for Integer1 = $TF_Integer1$ (where TF_Integer1 is the table column of the current row in ConfigTable)

      * ActiveLink-Push pushes Character1 and Integer1 to TargetForm

       

      I am looking for an alternative where I don't have to replicate the fields from ConfigForm on DisplayForm since in reality that will have to be 15 fields or so. ActiveLink-Pull will also need If Action 0 to set all the replicated fields to $NULL$ before Action 1 does the set fields from the table row (to account for any records in ConfigForm that have null fields).

        • 1. Re: How can I build a simple table walk to combine table data and other data
          Mohammad Rehman

          You have mentioned two tables source and destination, will user cherry pick from config table and cherry pick target table OR all source config table rows one by one will be pushed to target form all rows? What would be the source and target rows mapping?

           

          ***Instead of setting Integer1 field you can directly use $TF_Integer1$ field in push action too to reduce one step.

          • 2. Re: How can I build a simple table walk to combine table data and other data
            Rick Westbrock

            Thanks Mohammad I am using the TF_fieldname method elsewhere but was drawing a blank today. I also didn't want to include a large number of hidden fields in the able if it could be helped. The AL that calls the guide would table loop only selected rows, the desired end result is to create one new row in TargetForm for each selected table row. The Run If in the push fields active link would be 1=2 so that it always creates a new record in TargetForm.

             

            I just had an epiphany that if I include the InstanceID field in the table I could just push that into the TargetForm then use filters there to go look up all the other fields in the ConfigForm by matching on InstanceID. I have a bunch of control fields on TargetForm so the push fields can use CurrentCommand = "CreateRecordFromConfig" which the filter would have in his Run If qualification.

            1 of 1 people found this helpful
            • 3. Re: How can I build a simple table walk to combine table data and other data
              Jason Miller

              I think you might be on to something there... Push a unique ID and then have filters do the back-fill work. Pushing a single field value is light over the wire between browser -> MT -> AR and then let AR -> DB do the heavy lifting.

               

              Short of that does the Run Process "Application-Copy-Field-Value targetFieldID sourceFieldID" help you?

              Copies a field on the current form to another field on the current form. Returns one of the following integers:
              
              
              1 — The assignment failed.
              0 — The assignment occurred.
              To get the return value, use this command in a Set Fields action with $PROCESS$. This command cannot be used in a Run Process action.
              
              
              For example:
              
              
              $PROCESS$ Application-Copy-Field-Value $zTmpWeekDayField$ $WeekDay$
              
              1 of 1 people found this helpful
              • 4. Re: How can I build a simple table walk to combine table data and other data
                Mohammad Rehman

                If you need to fetch more information from config form on target form apart from the Integer1 which are not present in the config table then pushing the instance id would be better other wise you can add rest of the fields in the config table and hide them and push them in the push action will be better. OR you can touch the config table selected rows with action command and push to create target table.

                Anyway it would be nice to keep the config table instance id on the target form for reference.