Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Merrill
2017-09-19T16:38:27Z
I have many .pdf files being saved to a directory throughout the day and they are saved with a consistent filename with index values separated by ^. For example the filename could be:

First Name^Last Name^City^State^LastDate^datetime.pdf

I need to reorder the variables slightly so it matches up with our archive import system. Something as simple as:
State^City^First Name^Last Name.pdf

I'm using a File created trigger and then the Rename tasks uses the File.Result.Name variable to know which file to rename.
For the new filename mask I'm using GetColumn to pull each variable between the ^ separator and rebuild the new filename and I'll show this with line breaks between each index values:

{STRING(GetColumn|1|4|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})} ^
{STRING(GetColumn|1|3|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})} ^
{STRING(GetColumn|1|1|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})} ^
{STRING(GetColumn|1|2|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})}.pdf

It works up to two index values but anything after 2 and it renames the file to "Column number (3) higher than existing columns(1).pdf". I think I need to switch to regex...

On a side note, it shows an output error 77777 Invalid Characters in Filename , even though it renames the file properly with 1 or 2 index values, so I just turned that off from the Exit Code Collection.
Sponsor
Forum information
Support
2017-09-19T16:54:22Z
Originally Posted by: Merrill 

I have many .pdf files being saved to a directory throughout the day and they are saved with a consistent filename with index values separated by ^. For example the filename could be:

First Name^Last Name^City^State^LastDate^datetime.pdf

I need to reorder the variables slightly so it matches up with our archive import system. Something as simple as:
State^City^First Name^Last Name.pdf

I'm using a File created trigger and then the Rename tasks uses the File.Result.Name variable to know which file to rename.
For the new filename mask I'm using GetColumn to pull each variable between the ^ separator and rebuild the new filename and I'll show this with line breaks between each index values:

{STRING(GetColumn|1|4|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})} ^
{STRING(GetColumn|1|3|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})} ^
{STRING(GetColumn|1|1|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})} ^
{STRING(GetColumn|1|2|^|{TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)})}.pdf

It works up to two index values but anything after 2 and it renames the file to "Column number (3) higher than existing columns(1).pdf". I think I need to switch to regex...

On a side note, it shows an output error 77777 Invalid Characters in Filename , even though it renames the file properly with 1 or 2 index values, so I just turned that off from the Exit Code Collection.



Regex probably better. I think the Invalid characters is a real error. I recommend writing all values to file before using it - it is probably wrong at some moment.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
thomas
2017-09-19T21:16:06Z
Regex is probably more elegant in this case, but it works fine with a simple GetColumn also. Your example should work fine (I just tested it). You should also write the filename to a job variable, so that you don't have to reference the ugly trigger name 4 times.
Use a set job variable task, and write this part to a variable: {TRIGGER(Active|e05d3af3-be95-48d0-9b0a-bd9cc4d65e9c|File.Result.Name)}

Then this works fine. I called the variable 'file'. Change the order any way you like:

{STRING(GetColumn|1|1|^|{JOB(Active,Variable,file)})}^{STRING(GetColumn|1|2|^|{JOB(Active,Variable,file)})}^{STRING(GetColumn|1|3|^|{JOB(Active,Variable,file)})}^{STRING(GetColumn|1|5|^|{JOB(Active,Variable,file)})}.pdf

My guess is that you have invisible control characters in your file messing up. Open the file in notepad++ and see if you can find something fishy. See the accepted answer in this stackoverflow thread.

https://stackoverflow.co...ow-all-hidden-characters 

Thomas
Scroll to Top