2 Replies Latest reply on Dec 3, 2013 2:57 PM by SteveMartino

    Help with Replace Field Contents in a Script.

    SteveMartino

      Title

      Help with Replace Field Contents in a Script.

      Post

           Hello Forum & Phil.  I was wondering if there was a better way to write this script.  Shown below on the screenshot (upper left corner) is a field on the layout.  It has Global Storage and is one cell (comprised of 2 pieces of data) and is updated via script to import from an Excel Spreadsheet--no problems with this.

           Below this on the screenshot, with one of the 2 steps highlighted in question, is the step where I extract the number on the right side of the "/" .   I repeat this for the left side of the "/".  This works fine also.

           Here's my question.  In the near future those numbers will change to 6 digit numbers.  So either I would have to change this script step (or remember to) when that happens, or change the script step so it would take all the numbers from the right side of the "/".  And of course change the other script step for the left side.

           As always any help or direction is always greatly appreciated.

           Thanks

           Steve

      ss2.png

        • 1. Re: Help with Replace Field Contents in a Script.
          philmodjunk

               You could use the Position function to find the postion of the / character and then extract the digits to the left and right of this position, but Raybaudi showed me a better way some time back:

               GetValue ( Substitute ( Contacts::ImportedDDayinfo ; "/" ; ¶ ) ; 1 )

               returns the digits to the left of /

               GetValue ( Substitute ( Contacts::ImportedDDayinfo ; "/" ; ¶ ) ; 2 )

               returns the digits to the right.

          • 2. Re: Help with Replace Field Contents in a Script.
            SteveMartino

                 Too fast Phil!!! Give a guy a chance!!  I was just playing around with the Position Function.

                  Raybaudi seems to be a master at this kind of stuff.

                 Seriously though, thanks again :)  I'll give it a whirl tomorrow, as I can't play anymore and have to get back to work.