none
Converting DT_STR to DT_BOOL

    Question

  •  

    Can anyone tell me how to convert a string variable to boolean

    Ihave a variable named VarLoc which is string datatype

    In expression I want to give condition like

    VarLoc == "1234"?False:True

    its giving error because of converting string datatype to boolean.

    Please help.

    Thank You

    Wednesday, May 28, 2008 12:55 PM

Answers

  • This is how I would approach this problem: Create a new variable named BoolVarLoc (or whatever) of data type Boolean and give it this expression:

     

    @[User::VarLoc] == "1234" ? False : True

     

    Then you have two variables - one of type String and one of type Boolean. It works as desired for me in my test package.

    Wednesday, May 28, 2008 1:00 PM
    Moderator

All replies

  • This is how I would approach this problem: Create a new variable named BoolVarLoc (or whatever) of data type Boolean and give it this expression:

     

    @[User::VarLoc] == "1234" ? False : True

     

    Then you have two variables - one of type String and one of type Boolean. It works as desired for me in my test package.

    Wednesday, May 28, 2008 1:00 PM
    Moderator
  • Thank you

     

    Wednesday, May 28, 2008 3:48 PM