Community forum

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


rgepfert
2011-09-13T13:19:16Z
I have a file (AE_OnlineCodes_10012011_707.txt) that I am trying to parse the 4th node in the filename (707). This node can be either 2 digits or 3 digits. So, I was going to use the Substring function to get to the position. But I needed a way to calculate the length of the number (either 2 or 3). So, I decided to use LastIndexOf for the last UnderScore before the number to get the beginning position of the number. Then use the IndexOf for the .txt to get the end position of the number. Then subtract those two numbers to get the length. The script is as follows:

{STRING(Substring|{TRIGGER(5c777209-bd0f-4611-8658-591a6d3dd2d6,LastTrigger,File.Result.Name)}|24|{MATH(Subtract|Integer|{MATH(Subtract|Integer|{STRING(IndexOf|{TRIGGER(5c777209-bd0f-4611-8658-591a6d3dd2d6,LastTrigger,File.Result.Name)}|.txt)}|{STRING(LastIndexOf|{TRIGGER(5c777209-bd0f-4611-8658-591a6d3dd2d6,LastTrigger,File.Result.Name)}|_)}|#0)}|1|#0)})}

If I do all the IndexOf, LastIndexOf and Subtract functions on their own, I get 3 which is the number I need to put in the substring. But when I put those combined functions into the Substring I get back a blank string.

Can anyone see what I am doing wrong?

Thanks,
Robert
Sponsor
Forum information
Support
2011-09-14T18:19:32Z
Wow, this is not easy to follow. I would try first to hard code the values you expect instead of using the Name Variable. Also, it is probably more readable if you used:

{TRIGGER(Active,LastTrigger,File.Result.Name)} instead. If you are looking at this in the same Job.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top