Hidden Key populated with variables padded

 6 Replies
 1 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
Todd Mitchell
Veteran Member
Posts: 87
Veteran Member

    I am creating a process flow for both PA52 and PA56.  These forms require a hidden key (hk) value to be populated.  I am using variables to populate the field:  _HK=

    The Company and Employee field appear to be left padded with zeros automatically (as I know I they are not being passed in with the data).  However, the Action Code needs to be left justified, space filled right in order for the hk to be populated correctly.  How is this done with Process Automation?

    Bob Canham
    Veteran Member
    Posts: 217
    Veteran Member
      You can use built-in javascript functions to pad your strings. There is a addLeadingSpaces, addTrailingSpaces, addLeadingZeros, and addTrailingZeros functions that will do this for you. You just pass in the value to pad and the final length you need. These should show up in the function drop down in your assign or javascript nodes.
      Todd Mitchell
      Veteran Member
      Posts: 87
      Veteran Member

        Thank you -- that worked.  However that now exposes something else that I don't know what is happening.  The HK is being populated with trailing zeroes now:

        PA52_1__HK = 0001000099999TERMINATE 201406250000

         

        The last 4 zeroes are not supposed to be there.  They are not on the input data.  Here is my PA52 definition:  _HK=&

         

        Why does it tag on the trailing 4 zeroes.

        John Henley
        Posts: 3353
          That is an internal sequence number, for when you have multiple actions for same company/employee/action code/effective date
          Thanks for using the LawsonGuru.com forums!
          John
          Todd Mitchell
          Veteran Member
          Posts: 87
          Veteran Member

            Is there an easy way to strip it off, because it is causing an issue for the subsequent PA56 comment add.  PA56 is not putting this sequence number on the HK.

            John Henley
            Posts: 3353
              you want the first 31 characters:
              4 company
              9 employee
              10 action code
              8 date
              use javascript substring() function, e.g.
              PA52_1__HK_31 = PA52_1__HK.substring(0,31);
              Thanks for using the LawsonGuru.com forums!
              John
              MarkH2002
              Basic Member
              Posts: 5
              Basic Member

                Option 2: pass the variables by field name using the _DATAPARAM

                Example: /lawson/portal/index.htm?_TKN=GL41.1&_PDL=PROD&_HK=_DATAPARAM~~GLC-COMPANY~1~~GLC-ACCT-PERIOD~9~~GLC-FISCAL-YEAR~2014~~GLC-SYSTEM~GL~~GLC-JE-TYPE~N~~GLC-CONTROL-GROUP~1~~GLC-JE-SEQUENCE~0~~PT-GLT-LINE-NBR~20

                Notice with this method there is no need for leading/trailing spaces or zeros.

                Also notice you are not limited to key fields.  In the example above I am also populating the position to field for GL41.1