locked
Validating numeric value in a filename RRS feed

  • General discussion

  • I have a file and the filename  should be like ABC_12345_RES_20150410.txt and i have to validate the filename.I am facing problem in validating the numeric value which can change and its length also can change.

    I am using the following expression to validate whether its the numeric value /not:

    (DT_I4)(SUBSTRING( @[User::FileName]  ,FINDSTRING( @[User::FileName]  ,"_", 1)+1, FINDSTRING( @[User::FileName]  ,"_", 2)-FINDSTRING( @[User::FileName]  ,"_", 1)-1)) == (DT_I4)(SUBSTRING( @[User::FileName]  ,FINDSTRING( @[User::FileName]  ,"_", 1)+1, FINDSTRING( @[User::FileName]  ,"_", 2)-FINDSTRING( @[User::FileName]  ,"_", 1)-1))

    This statement is failing the package when i am entering a character instead of digit.. But i don't want the package to fail rather i just want to log the exception in this case.

    Is there any other way to validate the numeric Value?

    Many Thanks in Advance!

    Friday, April 10, 2015 5:17 AM

All replies

  • Change the settings to not fail the task on error or redirect the failing rows to the error output - log them then recombine the rows if required for the remainder of your data flow.
    Friday, April 10, 2015 5:49 AM
  • Thanks a ton Martin for your advice.

    I can do that but Actually the conversion is failing.. its giving error that cannot convert to (DT_I8). M looking for any other  way to validate  the numeric value.

    Friday, April 10, 2015 11:23 AM