Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post Reply
mulderr
Newbie
Posts: 4
Joined: Thu Mar 16, 2017 5:04 pm

Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post by mulderr »

Hi all, this command
job.getVariableAsString("[Job.Origin]", s)
worked god in the earlier version on switch. But after upgrade to switch2017 it receive "The variable '[Job.Origin]' was evaluated to ''" (empty)

Should you have any advice?
freddyp
Advanced member
Posts: 1009
Joined: Thu Feb 09, 2012 3:53 pm

Re: Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post by freddyp »

I assume you are using the new web-based Switch Portal?

That the variable [Job.Origin] is not filled in is a known limitation. For security reasons browsers do not allow to get the path of a file that is being uploaded, and hence it is not possible to provide a value for that variable.

You can still use the SwitchClient of version 13 with Switch 2017: set Preferences - Internal communication - Job client type to Legacy.
mulderr
Newbie
Posts: 4
Joined: Thu Mar 16, 2017 5:04 pm

Re: Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post by mulderr »

Hi,
Thank you for answer. But I have a Legacy format

This jobs are incoming from the FTP modules.
I can see the value “Origin” in the “Define single-line text with variables”. But script doesn’t work. :cry:

The same problem has variable [Job.Hierarchy]

This is the javascript:
var Hie = job.getVariableAsString("[Job.Hierarchy]", s);
var Origin = job.getVariableAsString("[Job.Origin]", s);
s.log(1, "Info0= " + Hie);
s.log(1, "Info1= " + Origin);
mulderr
Newbie
Posts: 4
Joined: Thu Mar 16, 2017 5:04 pm

Re: Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post by mulderr »

I´m wrote to Enfocus support.
mulderr
Newbie
Posts: 4
Joined: Thu Mar 16, 2017 5:04 pm

Re: Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post by mulderr »

For better imagination
Attachments
3.PNG
3.PNG (60.15 KiB) Viewed 5462 times
2.PNG
2.PNG (83.16 KiB) Viewed 5462 times
1.PNG
1.PNG (50.2 KiB) Viewed 5462 times
freddyp
Advanced member
Posts: 1009
Joined: Thu Feb 09, 2012 3:53 pm

Re: Problem in switch2017 with job.getVariableAsString("[Job.Origin]", s)

Post by freddyp »

That is in Switch Scripter!? Of course [Job.Origin] is not filled in. [Job.Origin] can only be filled in in a flow. Try the script again by running it in a flow with a file actually coming from an FTP site!

There are lots of properties that get added to a job as it travels through a flow. Because in Scripter the job is not traveling through a flow these properties are not available by default, but you can add metadata, private data, hierarchy and other stuff yourself. Unfortunately for you you cannot add the job's origin.

This being said, I do not know what it is exactly you want to do with the job's origin, but can't you obtain the same result using the job's hierarchy info? And that is a piece of info that you can add in Scripter while testing. In case you do not know how to add that: click on the script name in the Fixture pane and in the Properties pane you will see properties where you can define the metadata, private data, hierarchy, ... of a job.
Post Reply