Change my variable ?

Post Reply
numnational
Member
Posts: 27
Joined: Tue Sep 30, 2014 3:28 pm

Change my variable ?

Post by numnational »

Hi all,

I want to change my variable in switch.

Example :
i have un pdf file with the name "JMIKxxxxx.pdf" i want to depose it with "Set Hierarchy Path" in "JDM" folder.
i have un pdf file with the name "MICPxxxxx.pdf" i want to depose it with "Set Hierarchy Path" in "MPG" folder.
and other and other...

Is it possible to changing the variable ? I want to attribuate "JMIK" = "JDM", etc...

I can make it with a rename tools but if a better solution exist it's better.

Thanks.
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Change my variable ?

Post by gabrielp »

If you have Scripting, you can use switch-private-data-write to write and modify variables with private data. If you don't have Scripter, you can use can use metaTagger in the appstore to do the same thing. Otherwise, you can use JobState to set a single variable within a folder, but I wouldn't recommend this.


Once you write your variable in your flow (lets say it's private data with the key "Code"), you can put that in your Set Hierarchy path with the "define single line text variables" option. You would enter in something like: [Job.PrivateData:Key="Code"].
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
numnational
Member
Posts: 27
Joined: Tue Sep 30, 2014 3:28 pm

Re: Change my variable ?

Post by numnational »

Thanks Gabriel,

I have scripting so i want to test switch private data, but i don't understand how i must install it to work with switch... can you show me a tutorial to install and use it ?

Thanks.
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Change my variable ?

Post by gabrielp »

Sure.

- Download it using the "clone or download button".
- Put the files somewhere.
- Drop in the Script configurator within Switch and load the private-data-write_25.sscript file.
- Set Key (the first one) to Code
- Set -> Value to JDM
- Duplicate the script
- Alter the -> Value of the duplicated script to MPG
- Now you have two of these private data scripts, one writing Code to JDM and the other writing Code to MPG.
- Set your hierarchy value to [Job.PrivateData:Key="Code"] by using "single line text with variables"
- Now jobs routed through the JDM pd script will resolve to the JDM hierarchy
---- Jobs routed through the MPG pd script will resolve to MPG hierarchy

If you can post your flow, I can alter it for you to build a working example. Otherwise, if you want to jump on Gitter, I can spend a few minutes with you to walk through it over a webinar.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
numnational
Member
Posts: 27
Joined: Tue Sep 30, 2014 3:28 pm

Re: Change my variable ?

Post by numnational »

Thanks a lot your explications are very clear.

I make your lessons, and you can find my flow here : https://www.dropbox.com/s/4e3q2wk1zi852 ... sflow?dl=0

It work perfectly. But...

As you see in my flow I have another solution in bottom of the flow with "attach job state". It work perfectly too. What do you think ? What is the best solution ?

Thanks.
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Change my variable ?

Post by gabrielp »

numnational wrote:I make your lessons, and you can find my flow here : https://www.dropbox.com/s/4e3q2wk1zi852 ... sflow?dl=0
Excellent work. ;) This is very good. But if you follow switch-best-practices, you can make it a bit more readible and easier to debug:

Image

One good thing to keep in mind is to make folders named something unique so when they fail, you can figure out exactly where they failed from.
numnational wrote: As you see in my flow I have another solution in bottom of the flow with "attach job state". It work perfectly too. What do you think ? What is the best solution ?
That's correct. You can do this with JobState, but I really don't recommend it. Using JobState is confusing because it is unclear what JobState actually is at any point in time. In this example, it's so simple so it doesn't get confusing. But as you make larger flows, or flows that pass jobs into other flows, at any point in time you'll not know what JobState is actually set to. Perhaps you set it to a CSR's email or a job quantity. With private data, you always know what the data is supposed to be. And of course the biggest limitation is that you can only write one variable at a time.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Post Reply