6 Replies Latest reply on Sep 5, 2018 3:17 PM by Logan Pegler

    PDM transition to write a variable based on another?

    Aaron Torberg

           Is it possible to write a variable based on the value of another variable as a transition action?  We have a branch in Germany and in the US.  The materials they call out are different than ours, but usually have a substitute US material and vice versa.  so I want to add an "alt material" variable and based on the first material write the value for an alternate material.

       

           I see dispatch might be able to do this, or we could write some custom API possibly?  I just don't know what this would even look like - the transition action would be set to "Execute Command", and then I would point it to a script/exe written in...???

       

      Sorry I know this is pretty vague, I'm out of my comfort zone for sure, but I would like to make this work.  Thanks for your help!

        • Re: PDM transition to write a variable based on another?
          Prasad Bhonsule

          It is possible to set a value of a variable during a workflow transition with the value of another existing variable, see screenshot below, I'm not sure if this achieves what you want?

           

          2018-08-31_00-52-55.png

          • Re: PDM transition to write a variable based on another?
            Logan Pegler

            Hi Aaron,

             

            It is definitely possible with dispatch, although the complexity depends on how many alternate materials you have. If there are many, it might not be the best solution out of the box.

            For a simple scenario of a couple materials you could try the following:

            You'll need to create a new dispatch script and start out by adding a variable, lets call it "Material A", we will use this to get the existing material off the datacard. Set it to read whatever the material property is called on your datacard:

             

            You can then use this to setup a Jump in dispatch to check the variable against a string of characters. if it equals this, continue, otherwise write a variable:

             

             

            Imagine this orders like the following:

            If {Material A = USA}

                 Set Material B = GERMANY

            } Else {

                 Set Material B = USA

            }

            If you want it to only set Material B to GERMANY if Material A = USA then you can use a double jump. Below is a screenshot of how I use it to archive files:

             

             

            If the conditions of the first jump are not met, then it will finish the dispatch script. If they are it continues. Hopefully this shines some light on what dispatch will do.

              • Re: PDM transition to write a variable based on another?
                Aaron Torberg

                Ok Logan Pegler I tried to set dispatch to complete this operation for me and I cannot get it to work.  Here is what I have so far:

                 

                The Action dialog:

                DispatchTest01.png

                State transition conditions:

                DispatchTest02.png

                The if condition:

                DispatchTest03.png

                The check out command - this is the one I am not sure about:

                DispatchTest04.png

                Here is where I set the new variable:

                DispatchTest05.png

                 

                In the state transition conditions, what does it matter if the event happens before or after the state change has occurred?

                In the check out operation is the "Selected File" the file passing through the transition?  Or is this a reference to an explorer window selected file where the dispatch command is running based on a menu command?

                 

                Thank you very much for the help - I think this is my solution, I just have to get it to work..

                  • Re: PDM transition to write a variable based on another?
                    Aaron Torberg

                    I'm sorry Logan Pegler, I am a dummy, I completely skipped over the step where I was supposed to get the data card variable and set it to a dispatch variable:

                    After I did this it all works as expected.  Thank you!

                      • Re: PDM transition to write a variable based on another?
                        Logan Pegler

                        Glad to hear you got it working Aaron,

                         

                        To clarify your points:

                        "In the state transition conditions, what does it matter if the event happens before or after the state change has occurred?"

                        It depends on what happens during the state transition. For example, is the state transition incrementing the revision of the file? Then should the dispatch script work with the old revision value or the new one? Not necessarily relevant in your scenario.

                         

                        "In the check out operation is the "Selected File" the file passing through the transition?  Or is this a reference to an explorer window selected file where the dispatch command is running based on a menu command?"

                        Both, depending on when your dispatch script is set to run. If it is a menu command based script, then it refers to the selected file(s) you ran the command on, if it is a state transition script then it refers to the file(s) passing through the state transition.

                  • Re: PDM transition to write a variable based on another?
                    Jeff Sweeney

                    I like Logan Pegler's idea. If the material list gets long, or you decide that you want to do several other variables, I don't have a free solution for you but PigeonHole has been used by several people in this way: PigeonHole helps multi-language data cards - YouTube