4 Replies Latest reply on Dec 10, 2013 10:07 AM by Hudi

    Behavior of Auto entry in GO vs Pro/Server


      Small problem has been occuring on a local file in FMGo 12-13.


      I have a button that has one script step attached to it, "Set next serial value". What that does is set the product serial number with a prefix and the number plus 1.
      For example,

      if the product name is BG0001, user clicks button, and the serial number should become BG0002.

      if the product name is FY00023, user clicks button, and the serial number should become FY00024.


      Script step looks like this:

      Set Next Serial Value[ Products::Product_Name; Filter ( Products::Product_Name ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ) & Products::Product_Name + 1]


      It works fine on Pro and when using Go with server hosted file. however when the file is local on the ipad it just adds the number.

      BG0001 turns into 00002. Without the prefix.



        • 1. Re: Behavior of Auto entry in GO vs Pro/Server

          You are filtering out all text.
          Did you define that field as a text field or as a number field?

          • 2. Re: Behavior of Auto entry in GO vs Pro/Server

            Text field



            • 3. Re: Behavior of Auto entry in GO vs Pro/Server

              Hi Hudi


              In your example you are including the 0 character in your filter list. This could result in an extra 0 in your result.

              You probably need to run two separate filters to account for BG00020 for example. You don't want to keep the trailing 0.

              Something like this:

              //L is left. M is middle and R is right.


              //I have removed the posiblity of encountering lowercase letters in the field and converted them to uppercase since Filter is case sensitve.

              T = Upper ( Products::Product_Name ) ;

              L = Filter (  T ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ;

              M = "000" ;

              R = GetAsNumber ( Filter ( T ; 1234567890 )) + 1]  ;

              L & M & R



              In this example the leading 3 zeros after the Alphabetic Prefix are hard coded but if that can vary then you need to use the "Position" and "Left" or "Middle" functions to set the value for "M" in my example. You may need to use the Case function to test for a few possible scenarios such as "0", "00", "000", or "0000" ect. It can get a little tricky but as long as you know you always want "000" then hard coding will work fine. You lose the leading zeros with the GetAsNumber function but then you just put them back.


              As for the missing Alphabetic prefix on iOS could it be simply the field is right justified and too small to display all the text? Also in your example, if the field contains lowercase text i.e. bg0001 then the Filter function would remove the letters since you have not included lowercase characters in your filter list.


              I tested my example calculation using a Set Field script step but there is no reason why it won't work with the Set Next Serial Value step. Of course you won't see the results until you create a new record.

              You may have other validation in place making the uppercase conversion I added unnecessary but it doesn't hurt anything. That way going forward all your records will have the proper formatting for that field. And since Filter is case sensitive you would lose your alphabetic characters if they are lowercase.



              • 4. Re: Behavior of Auto entry in GO vs Pro/Server



                Your solution is accurate. I didn't need the entire thing just the part where user is forced to enter UPPER characters into the field. That or filter for both upper and lower case characters. Either way, that did the trick.


                Many thanks!!