Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
heap_qlik
Creator
Creator

How to write IF statement in load script

Hi experts,

Can anyone help me how to write if statement in load script. I try below script and get error.

If

Currency='USD' then
          Sale*Exchange
     Else Sale

End If as Sale, 

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Sir,

This script is not correct in QlikView. Now let try:

[Data]:

LOAD

...

If(Currency='USD',Sale*Exchange,Sale)     As [Sale],

...

Regards,

Sokkorn

View solution in original post

6 Replies
Sokkorn
Master
Master

Hi Sir,

This script is not correct in QlikView. Now let try:

[Data]:

LOAD

...

If(Currency='USD',Sale*Exchange,Sale)     As [Sale],

...

Regards,

Sokkorn

View solution in original post

heap_qlik
Creator
Creator
Author

Sokkorn, it work!!!. Can you help to explain me on your statement?

Sokkorn
Master
Master

Hi,

If(Condition, then, else)

The three parameters condition, then and else are all expressions. The first one, condition, is interpreted logically. The two other ones, then and else, can be of any type. They should preferably be of the same type. If condition is true, the function returns the value of the expression then. If condition is false, the function returns the value of the expression else.

Example:

If(Amount>= 0,'OK','Alarm')

Regards,

Sokkorn

Not applicable

Load

If(Currency='USD',Sale*Exchange,Sale)     As [Sale]

From Source table....

heap_qlik
Creator
Creator
Author

Thanks bika_2010

heap_qlik
Creator
Creator
Author

Thank you Sokkorn. Very nice