Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set List Fields to multiple Expressions

Hi,

I have a field named DaySelect that contains T, T-1, T-2, T-3.

I would like to assign each one an expression, but I'm unsure how to do this.

I have been trying something like this, but it has not worked so far:

=if ([DateSelect] = 'T', [Actual Start Date] = Date(today()))

But even if this worked, I am unsure how I would then enlarge that expression to work for all four. I would like something like this:

=if ([DateSelect] = 'T', [Actual Start Date] = Date(today()))

=if ([DateSelect] = 'T-1', [Actual Start Date] = Date(today()-1))

=if ([DateSelect] = 'T-2', [Actual Start Date] = Date(today()-2))

=if ([DateSelect] = 'T-3', [Actual Start Date] = Date(today()-3))

Any help would be much appreciated.

Kind regards,

Tristan

1 Reply
hic
Former Employee
Former Employee

I would do this in the script. You can define a new field in the Load statement where you load the DateSelect:

Date(

if ([DateSelect] = 'T', today(),

  if ([DateSelect] = 'T-1', today()-1,

     if ([DateSelect] = 'T-2', today()-2,

        if ([DateSelect] = 'T-3', today()-3,'Error'))))

) as [Actual Start Date]


HIC