2 Replies Latest reply on Jul 26, 2012 5:46 AM by davehob

    Set Next Serial Value - including non-numeric data

    davehob

      During an import, I need to use the "Set Next Serial Value" script step. The key fields that I'm trying to set have non-numeric components, e.g. "PPL000101". The script step increments the numeric part, but leaves out the non-numeric and leading zeroes.

       

      FM help tells me that "If the ID contains non-numeric data, then the calculation would need to be more sophisticated to maintain the numeric and non-numeric data." I'm assuming that this means that I just have to build the key value as a text calc, e.g. "PPL000" & $NextKey (where $NextKey contains the numeric part of the key).

       

      Is that correct? (I need to do this for all of the 25-ish tables, so need to get it right...)

       

      Thanks,

       

      Dave.

        • 1. Re: Set Next Serial Value - including non-numeric data
          comment

          Dave Hobson wrote:

           

          The script step increments the numeric part, but leaves out the non-numeric and leading zeroes.

           

          The Set Next Serial Value[] script step sets the next value for the field to increment further; the step by itself does not increment anything.

           

          The incrementing mechanism is described in the help for the SerialIncrement[() function. In your example, the last non-numeric character is the L in the PPL prefix; anything after that, including the leading zeros, will be used as the numeric string to increment.

          • 2. Re: Set Next Serial Value - including non-numeric data
            davehob

            Thanks Michael,

             

            Yes, sorry, I did realise that Set Next Serial Value only did the setting, not the incrementing. 

             

            But thanks very much for the pointer to SerialIncrement, which I now see will do the incrementing for me - much better.

             

            Dave.