Looping through private data and adding to file name suffix
Posted: Thu Feb 14, 2019 3:28 am
Hi,
I have files arriving at a rename which contain private data that I want to add to the filename.
The private data will be Key 01, Value 01 to Key nn, Value nn (key name and the value they hold are the same so Key 88 would be value 88).
A job may have Keys 01 and 03, another job may have keys 04 and 05, there may be another job that only has key 02.
These jobs would end up being called
JobName-01-03
JobName-04-05
JobName-02
I'm looking to write a For Loop something like the below. This is riddled with errors and I'm working on it now, I welcome tips
Which produces nothing for OSTRING
curiously, CSTRING gives - so not quite there yet
I have files arriving at a rename which contain private data that I want to add to the filename.
The private data will be Key 01, Value 01 to Key nn, Value nn (key name and the value they hold are the same so Key 88 would be value 88).
A job may have Keys 01 and 03, another job may have keys 04 and 05, there may be another job that only has key 02.
These jobs would end up being called
JobName-01-03
JobName-04-05
JobName-02
I'm looking to write a For Loop something like the below. This is riddled with errors and I'm working on it now, I welcome tips
Code: Select all
//Output string
var OSTRING = 0;
//Loop string
var LSTRING = 0;
//Private Data Key
PDKEY1 = '[Job.PrivateData:Key="';
PDKEY2 = LSTRING
PDKEY3 = '"]'
//Check String
var CSTRING = 'PDKEY1'+PDKEY2+'PDKEY3';
//Incementor
for (var i=0; i < 99; i=i+1)
LSTRING = i;
if (LSTRING <= 9) {
LSTRING = '0' + LSTRING;
//Private Data Key
PDKEY1 = '[Job.PrivateData:Key="';
PDKEY2 = LSTRING
PDKEY3 = '"]'
//Check String
var CSTRING = 'PDKEY1'+PDKEY2+'PDKEY3';
}
if (LSTRING == CSTRING) {
OSTRING = OSTRING+'-'+LSTRING;
}
{
}
OSTRING
curiously, CSTRING gives
Code: Select all
_0DNHT_JobNamePDKEY10PDKEY3