I'm trying to teach myself Javascript in order to better use the Scripting module. I have a question about a syntax error in my first script.
I'd like to set the value of a property in a flow element with a simple script. I came up with the following:
var fileStat = new FileStatistics(job.getPath());
var checkPath = fileStat.getString("[Metadata.Text:Path="/field-list/field[2]/value",Dataset="NYCM-Sort-Submit-All",Model="XML"]");
if checkPath === "FIRST CLASS" {
return "C:/JSON_files/NYCM-260.json";
}
return "C:/JSON_files/NYCM-261.json"
The value is from an XML submit point dataset. I'm sure I'm way off base, but would appreciate it for someone to explain what I did wrong.
Thank you.
Syntax Error
Re: Syntax Error
FileStatistics are normally used for getting properties of a PDL file like number of pages, trim size etc. I think you want the embedded data set
Then you can use evalToString to get the value you want out of the XML:
Code: Select all
var dataset = job.getDataset("NYCM-Sort-Submit-All");
Code: Select all
var checkPath = dataset.evalToString("/field-list/field[2]/value", null);
Re: Syntax Error
I will make the change, thank you.
Enfocus doesn't really make interpreting the help file easy for beginners.
Enfocus doesn't really make interpreting the help file easy for beginners.
Re: Syntax Error
Thanks to posters here and some dedicated Internet research on my own, I'm getting better at the simple scripting. But, this is one area that Enfocus could really help out new users. The flow element and apps from the store will only get you so far, if you need to move into more advanced flows.
I wouldn't even mind paying for good, Switch-focused online training in Javascript and script development.
I wouldn't even mind paying for good, Switch-focused online training in Javascript and script development.