Create a column in table using If Function

  • 15 May 2023
  • 1 reply

I’m very new to TimeXtender and was hoping someone could assist with my issues. 


How would you use an “If” function in TimeXtender?

For example, I need to create a new column in my table called “Quantity” . I then need to look at the [code] column in the same table and bring back a value using an If Function. 

Something like this:

If [code] = 1 then ‘small’ else if [code] = 2 then ‘medium’ else if [code] = 3 then ‘large else if [code] = 4 then ‘x large’ else null.


Thank you


Best answer by Thomas Lind 15 May 2023, 13:40

View original

1 reply

Userlevel 5
Badge +5

Hi Claire

Here is how I would do something like that in TimeXtender.

I would create three fixed values on the field and then add conditions to these fields.

It goes through the options in alphabetical order, so I do not need to add a condition to the last one. If the first two conditions do not apply it will just add this one. If I wanted to be sure it only got set if it had a value I would add a condition to this as well. Then if any given Type was different from the set options it would not be set with a value.

Here is how the transformation view looks if I set a condition on all three options.

As you can see the code generated is similar to what you would normally do for a IF statement in SQL.