Hi all,
I have SSIS Package in which we uploads files and fetch date based on the file name.
The file name was ImportFile_XXX_20220501.
We used such expression (DT_STR,8,1252)SUBSTRING(FILE_NAME,FINDSTRING(FILE_NAME,"_",3) + 1,8) to receive int date.
Currently, the file name was changed to the ImportFile_UK_DumpXX_20220501.
Also, I have one variable in which I pass some specific parameter - FileCode. And I need to parse the new file name only when FileCode =1 .
Could you please help me to change the existing expression?
Thank you.
May 26, 2022 at 12:41 pm
If the file name is "ImportFile_UK_DumpXX_20220501", what exactly do you want the expression to return?
If FileCode <> 1, what do you want the expression to return?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 26, 2022 at 1:16 pm
Hi Phil,
I need to return this number 20220501 if FileCode <>1.
Also I forgot indicated the correct file name.
It should be ImportFile_UK_DumpXX_20220501_XX.
The following expression returns 20220501 if FileCode = 1, and an empty string otherwise.
@[User::FileCode]==1?token(@[User::FileName], "_", 4) : ""
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 26, 2022 at 3:27 pm
Phil,
it works great but without FileCode.
File code is string value, so I wrote @[User::FileCode]=='1'. Destination column is int.
I received an error that it can't convert unicode to non-unicode...
May 26, 2022 at 3:52 pm
Phil,
I have already fixed it.
Thanks for your help!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply