Findstring function issue

  • Hello,

    I've got a variable that is storing a fully qualified pathname such as

    ---- \\servername\folder1\folder2\filename.ext

    I need to extract the "folder2" name from this variable and pass it into the body of an e-mail message for our users. I'm currently trying to pass this variable into an expression in the send mail task where the following function is applied.

    SUBSTRING( @[User::varFileName] , 25, FINDSTRING( @[User::varFileName] , "\", 4))

    The piece that is not working is the FINDSTRING function, and I believe the issue is my using the "\" as my string. It keeps giving me the follow error...

    TITLE: Expression Builder

    ------------------------------

    Expression cannot be evaluated.

    ------------------------------

    ADDITIONAL INFORMATION:

    Attempt to parse the expression "FINDSTRING( @[User::varFileName] ,"\", 4 )" failed. The token """ at line number "1", character number "35" was not recognized. The expression cannot be parsed because it contains invalid elements at the location specified.

    (Microsoft.DataTransformationServices.Controls)

    Any ideas on what else I could try?

    😀

  • You will have to escape '\' character. Try

    SUBSTRING( @[User::varFileName] , 25, FINDSTRING( @[User::varFileName] , "\\", 4))

  • Thanks Grasshopper, that did the trick.

    😀

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply