Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

heap_qlik
Contributor

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
Honored Contributor

Re: How to write IF statement in load script

Hi Sir,

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

[Data]:

LOAD

...

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

...

Regards,

Sokkorn

6 Replies
Sokkorn
Honored Contributor

Re: How to write IF statement in load script

Hi Sir,

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

[Data]:

LOAD

...

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

...

Regards,

Sokkorn

heap_qlik
Contributor

Re: How to write IF statement in load script

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

Highlighted
Sokkorn
Honored Contributor

Re: How to write IF statement in load script

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

Re: How to write IF statement in load script

Load

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

From Source table....

heap_qlik
Contributor

Re: How to write IF statement in load script

Thanks bika_2010

heap_qlik
Contributor

Re: How to write IF statement in load script

Thank you Sokkorn. Very nice