easy script for rename job flow element?

Post Reply
Fist
Member
Posts: 27
Joined: Mon Aug 31, 2015 2:49 pm

easy script for rename job flow element?

Post by Fist »

I have a .csv file which need to be renamed by using a parameter in that .CSV.
I would need a script expression to do this.

It should be like:

if tag <MyParam> contains yes
then add prefix Y
else add prefix N

Can anyone translate it into a propre javascript expression?

Thanks!

Fist
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: easy script for rename job flow element?

Post by Padawan »

This Script Expression will search for SearchString in the current job. You can use this Script Expression in the Rename Job element to choose which prefix to add.

Code: Select all

var fileContent = File.read(job.getPath(), "UTF-8");
var theReturn;

if (fileContent.find("SearchString") > 0)
{
	theReturn = "Found";
}
else
{
	theReturn = "NotFound";
}
theReturn;
Post Reply