Page 1 of 1

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

Posted: Thu Mar 16, 2017 5:11 pm
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?

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

Posted: Thu Mar 16, 2017 8:12 pm
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.

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

Posted: Fri Mar 17, 2017 12:53 pm
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);

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

Posted: Fri Mar 17, 2017 12:55 pm
by mulderr
I´m wrote to Enfocus support.

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

Posted: Fri Mar 17, 2017 2:06 pm
by mulderr
For better imagination

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

Posted: Mon Mar 20, 2017 9:27 am
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.