15 Replies Latest reply on Apr 4, 2019 5:07 AM by Lukasz Rybacki

    EPDM Dispatch remembers runtime variables?

    Thomas Horst

      I have a dispatch action in EPDM that is set up to fire on a state transition, and fill in the Sales order and line item number of all the parts transitioned, if they aren't already populated.

       

      The first time it runs into one that isn't populated, it will put up two dialog prompting for the numbers. on all subsequent ones, it should just fill in the number it was already given. As it loops through the files, it checks if the variable is blank, and if not, skips over, and also checks if the runtime variables for the line and SO number already exist (if they have, it uses them, if not, it prompts).

       

      I've run into a strange behavior where it seems that after running it the first time, it seems to remember forever what was entered into the runtime variables from previously, and not prompt even when it finds the first blank value on this run. It just fills it with the same thing I input on the first test run without prompting.

       

      Is there a way I can set all runtime variables to NULL each time the script starts? I would have assumed it did this by default for runtime vars. Is this a glitch, or intended behavior?

       

      Thanks,

       

      Thomas

        • Re: EPDM Dispatch remembers runtime variables?
          Iftach Priel

          Thomas,

          Runtime variables stay set just as long as the script runs (hence the name). No need to delete them.

          could the wrong values come from the selected file after all?

            • Re: EPDM Dispatch remembers runtime variables?
              Thomas Horst

              No, I can quite clearly see that the file variables are blank in the data card before the script is run, and the Set variable in the scrip is definitely updating them. on the first time through the loop in the script, it should prompt for the user to input the variables, but after the very first time running the script, it just doesn't. It uses the same value from the very first time I ran it.

            • Re: EPDM Dispatch remembers runtime variables?
              Brian McEwen

              I have not seen this particular thing. But I have a Dispatch script that will prevent a change state if a variable is filled in wrong.  It works fine normally, but if you try to run the change state twice in a row Dispatch fails to stop it the 2nd time, so like you said, it is as if Dispatch did not initialize correctly.

              • Re: EPDM Dispatch remembers runtime variables?
                Thomas Horst

                I created a simplest case test script to confirm the behavior. It consists of one runtime variable, and steps:

                If Var is not blank (already has value), jump to "already has value"

                edit box -> Var

                Label: already has value

                Message box Var

                 

                It behaves exactly the same. The first time you run the script (after it is written, or after restarting), it prompts you for a value and shows it. All times it is run after that, it does not prompt, it just shows the value from the first time. And there doesn't appear to be any functionality in dispatch to write a temporary value into a runtime variable, or clear it. Runtime variables appear to be solely for getting input from edit box or combo box, and they seem to remember that value.

                  • Re: EPDM Dispatch remembers runtime variables?
                    Brian McEwen

                    I assume the runtime variable clears if you exit EPDM?

                     

                    Let me see if I can make sense of your script. I'm just trying to understand it and think if there is another way to structure this, given that bug... 

                    So if the Existing SO does not equal nothing (card variable has a value) the script will skip that file and continue (even if SO Number is nothing).

                     

                    If the SO Number (runtime variable) equals nothing, then the script goes to get two values from the user.

                     

                    Okay, you have the Jump (If-then) on the runtime so that the user does not need to enter it more than once.  

                     

                    ... Have you tried Write Registry Value?  You could put it at the very end. I've never used it, but it might be the thing you need.

                    If you must put in a value you could put in something weird that you also check for with a 3rd Jump.

                  • Re: EPDM Dispatch remembers runtime variables?
                    Iftach Priel

                    Thomas,

                    Any difference in behavior if you run the script on multiple selected files as opposed to single files, one after the other?

                    (just for debugging, when using the menu command "Update SO", and not the transition)