Toad World® Forums

AUTOMATION If Condition for String Variable

Hi All,

I’m using TDP 4.1 and would like to know if it is possible to create an If… Condition… branch based on a variable with a string data type. I have created a variable #LIST_TYPE# that can have 1 of 3 values: (PROMO, LOC, or PIF)

When I use any of the following expressions #LIST_TYPE#=‘PROMO’ , #LIST_TYPE#=“PROMO” or #LIST_TYPE#=PROMO I receive the error: If_1 - ‘PROMO=PROMO’ cannot be converted to boolean. during execution of the automation script.

I will switch to a numeric variable, if I have to, but I wanted to be certain that there wasn’t something that I’m overlooking first.

Thanks!

-Marco

In the SET_VARIABLE activity, enclose the value between single quotes.

In the IF_Condition, set the expression as: ‘#LIST_TYPE#’=‘PROMO’

where the #LIST_TYPE# is enclosed in single quotes.

Thank you TDP_OWL! I would have never thought to wrap the ‘#variable_name#’ in single quotes on the left side of the equality expression. BTW, Data Point adds the apostrophes to the PROMO string data type automatically, so that step is optional. Did you see this in the documentation or online help? All of the conditional examples that I found were numeric. Thanks again. -Marco