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