I'm parsing data from an SFTP call to get the file name. I'm returning _list values that have all the FTP properties of each file. I use an AttributeCreator get the length of this string as an attribute (ListStringLength=69) --- @StringLength(@Value(_list))
- -rwxrwxrwx 1 user 278361 date 00137 0001539147T ABCDEFG1234567.jpg
I'm also using the AttributeCreator to get the starting position of the file name based on the prefix as another attribute (StartingPosition=33) --- @FindString(@Value(_list),"00137 0001539147T")
- 278361 Mar 21 09:49 00137 0001539147T ABCDEFG1234567.jpg
From here, I tried to simply subtract. But that didn't work.
@Value(ListStringLength)-@Value(StartingPosition) = a string value 69-33
So then I added an SQLExecuter and did the math in SQL and output the FileNameLength.
select @Value(ListStringLength)-@Value(StartingPosition) as FileNameLength
From here, I added an AttributeCreator to get the FileName. @Substring(@Value(_list),@Value(StartingPosition),@Value(FileNameLength))
I've uploaded my test fmw.
Thanks,
James