Hello,
We have an issue with the submit hierarchy tool and the script expressions used to . Maybe someone could help us.
We have one hierarchy folder when the production files are stored. There is one folder per date in format DDMMYYYY
We are trying to set up a maintenance flow to copy the file for the current date to the backup server at the end of production.
We are using the Submit hierarchy tool (set up to the root of the production folder) and adjust the processed folders using the rules.
To define the process folder we use the next script expression:
var date = new Date();
var sdate = date.toString();
sdate= sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
This expression has been tested with SwitchScripter and returns a correct value of DDMMYYYY
Using this script expression in the Folder name property of the adjustment rules for the Submit Hierarchy tool does not work. Everything in the submit tool is ok, if we set up the name using patterns or regular expressions it works, so everything point to the script expression.
Has anybody experience with the script expression in the submit hierarchy tool?.
Any help will be very much appreciated.
Script expression in the submit hierarchy tool
-
- Newbie
- Posts: 4
- Joined: Mon Nov 22, 2010 11:09 am
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Script expression in the submit hierarchy tool
The last line of a script expression should be the value you want to return.
var date = new Date();
var sdate = date.toString();
sdate= sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
sdate;
or just
var date = new Date();
var sdate = date.toString();
sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
var date = new Date();
var sdate = date.toString();
sdate= sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
sdate;
or just
var date = new Date();
var sdate = date.toString();
sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
-
- Newbie
- Posts: 4
- Joined: Mon Nov 22, 2010 11:09 am
Script expression in the submit hierarchy tool
Hello Dkelly,
Thanks first for the quick reply.
Unfortunately, the behaviour is the same using your code or ours. Testing in Switchscripter, both codes return the same
Script evaluation result: 11072013 [type: QString]
This is the current date, so it is correct.
I am pretty sure that the problem is in the Submit hierarchy tool, but we don´t know how to resolve it. We have tried your code.
I attach a link to a simplified version of the flow, so you could test it of you want.
Submit hierarchy tool with script expression
Thanks again.
Thanks first for the quick reply.
Unfortunately, the behaviour is the same using your code or ours. Testing in Switchscripter, both codes return the same
Script evaluation result: 11072013 [type: QString]
This is the current date, so it is correct.
I am pretty sure that the problem is in the Submit hierarchy tool, but we don´t know how to resolve it. We have tried your code.
I attach a link to a simplified version of the flow, so you could test it of you want.
Submit hierarchy tool with script expression
Thanks again.
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Script expression in the submit hierarchy tool
After talking with Enfocus tech support it turns out that the return type for the script element should be a boolean not a string. So you are telling Switch that the current file/directory is OK to process or not.
var date = new Date();
var sdate = date.toString();
sdate= sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
job.getNameProper() === sdate;
Dwight Kelly
Apago, Inc.
dkelly@apago.com
var date = new Date();
var sdate = date.toString();
sdate= sdate.substring(8, 10) + sdate.substring(5, 7) + sdate.substring(0, 4);
job.getNameProper() === sdate;
Dwight Kelly
Apago, Inc.
dkelly@apago.com
-
- Newbie
- Posts: 4
- Joined: Mon Nov 22, 2010 11:09 am
Script expression in the submit hierarchy tool
Hello Dwight,
We will try this approach.
In the meantime, we have solved it using a "pure" script, timerfired, instead of the submit hierarchy tool.
Regards,
Víctor Corchado.
We will try this approach.
In the meantime, we have solved it using a "pure" script, timerfired, instead of the submit hierarchy tool.
Regards,
Víctor Corchado.