Skip to main content
Solved

Create a column in table using If Function

  • May 15, 2023
  • 1 reply
  • 327 views

Acumen
Visitor

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

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.

View original
Did this topic help you find an answer to your question?

1 reply

Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 1017 replies
  • Answer
  • May 15, 2023

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings