9 Replies Latest reply on Mar 8, 2017 3:52 PM by Ben D.

    Truncate data card variable

    Shaun Toms

      So, we have an ECN workflow and I've been adding the variables to Excel and the data card so that excel is populated automatically with what we enter on the data card. For the longest time, on the data card, we left the ECN cell blank and required everyone to type in the actual number. This is because when we run the New ECN command on the PDM server, it creates the filename as ECN-1234 and if we have the template_variable = the card_variable then it puts ECN-1234 on the data card. This results in the datacard saying the following,

      ECN: ECN-1234

       

      Now, I know how to truncate in excel and I can easily create a hidden cell that has the card_variable and then the field that has the ECN number only shows the last 4 characters. But it still looks really silly that the datacard shows the above.

       

      Is there anyway I can make the card show only the last 4 characters so it reads like this,

      ECN: 1234

        • Re: Truncate data card variable
          Michael Dekoning

          Shaun,

          Forgive me if I'm missing something but if you're using a PDM Template, why not have the ECN number consist of only the digits then add the prefix in the file name?

          • Re: Truncate data card variable
            Ben D.

            In PDM administration, go:

            Help>Datacards>Input formulas>Input formula functions

            Go to string functions:

            FunctionRight Substring
            DescriptionReturns the rightmost specified number of characters from a specified string.
            SyntaxRight(<string>,<number>)
            Arguments<string> - The character string

            <number> - The number of characters to be returned

            ExampleRight(ProjectAA,2)

            Returns "AA"

            Now, in the datacard, at the properties of your "Edit box", at the very bottom there is a "Input formula". Enter the format you need, it should work.

              • Re: Truncate data card variable
                Shaun Toms

                Tried this option first. In the input section I entered the following,

                Right(%ECN_Number%,4)       

                the %ECN_Number% was generated when I clicked the right arrow in that input cell, and inserted the variable string.

                 

                Which from what you showed and what I see in the Help, should take the following,

                ECN-1234  and return  1234

                 

                Unfortunately, no such go. I verified we are using PDM Professional, so not sure why it doesn't work.

                 

                I'm gonna play around with it some more. in the meantime, I'm gonna try out Michael Dekoning 's solution. But I intend to try and figure out why that doesn't work so that in the event something else comes up, I can use that solution.

                 

                Oh, and thanks to both of you for responding so quickly. Really appreciate it.

                  • Re: Truncate data card variable
                    Tim Webb

                    Hi Shaun,

                    You can control this in a few places. The file card, template card, template variables, etc. If you are using the PDM templates to create your ECN documents, then I recommend controlling this in the template card. Once the ECN is created, you probably don't want users to be updating your ECN number on the file card because these are usually read only values.

                     

                    I've attached an export of a sample template, the file card it uses, and it includes the template docm file it needs. Import the attached .cex into a sandbox vault NOT a production vault and don't overwrite any groups it wants to create.

                     

                    When imported, the cex file will create a folder called "Change Notifications", it will store the docm in a folder called Templates, it will create the serial number generator called  "Change Notifications", the template, template card, and file card. See how it works for you.

                     

                    Best,

                    Tim CEPA

                    Believe in The Q!

                    • Re: Truncate data card variable
                      Ben D.

                      Not sure if I understand you correctly, but I think it works for me (see the attached screen capture)

                      • Re: Truncate data card variable
                        Michael Woerther

                        The problem with the input formulas is that they do only trigger on manual input: So if you type into the card, the formula works fine, but it does not trigger if  a document property or similar is read out.