Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor III

After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

Hi All

i Have the below expression work fine :-

'S$ ' &Num(

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1)) * days3)

+ sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1)) * days6) +

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1)) * days9) +

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1))*above12)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1)) * curren)

,'###,##0.00')

I try to adding one more currency for MYR :-

'S$ ' &Num(

sum(If( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days3)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days6) +

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days9) +

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1)))*above12)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * curren)

,'###,##0.00')

above expression return null value , can some one advise me where i go wrong ?

Paul

1 Solution

Accepted Solutions
Partner
Partner

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

your condition has one execution path to much

if (US_Cust='EU',1.5,1, if

if =EU then 1.5; if not EU then 1; when next if should be performed?

'S$ ' &Num(

sum(If( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days3)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days6) +

View solution in original post

7 Replies
Partner
Partner

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

your condition has one execution path to much

if (US_Cust='EU',1.5,1, if

if =EU then 1.5; if not EU then 1; when next if should be performed?

'S$ ' &Num(

sum(If( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days3)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5, 1,if(US_Cust='MYR',1/3, 1))) * days6) +

View solution in original post

trdandamudi
Honored Contributor II

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

May be as below:

'S$ ' &Num(

sum(If( US_Cust='USD', 1.3,if(US_Cust='EU',1.5,if(US_Cust='MYR',1/3, 1))) * days3)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5,if(US_Cust='MYR',1/3, 1))) * days6) +

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5,if(US_Cust='MYR',1/3, 1))) * days9) +

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5,if(US_Cust='MYR',1/3, 1)))*above12)+

sum(If ( US_Cust='USD', 1.3,if(US_Cust='EU',1.5,if(US_Cust='MYR',1/3, 1))) * curren)

,'###,##0.00')

Highlighted
gferran
New Contributor III

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

Paul,

i think the brakets are not ok. Look at this:

Clipboard03.png

the second if has three options! I have worked with your first if sentence.

Regards,

Gabriel

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

Try to write full expression instead of days3,6,9,12, curr

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
paulyeo11
Valued Contributor III

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

Hi Rudolf

Thank you very much

PAul

paulyeo11
Valued Contributor III

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

Hi Anil

I think you got the point , as now i need to more condition , i find it hard to handle , are you able to share the how to simplify the below expression :-

'S$ ' &Num(

sum(If ( US_Cust='USD', 1.3,If ( US_Cust='MYR', 1/3,if(US_Cust='EU',1.5, 1))) * days3)

+ sum(If ( US_Cust='USD', 1.3,If ( US_Cust='MYR', 1/3,if(US_Cust='EU',1.5, 1))) * days6) +

sum(If ( US_Cust='USD', 1.3,If ( US_Cust='MYR', 1/3,if(US_Cust='EU',1.5, 1))) * days9) +

sum(If ( US_Cust='USD', 1.3,If ( US_Cust='MYR', 1/3,if(US_Cust='EU',1.5, 1)))*above12)+

sum(If ( US_Cust='USD', 1.3,If ( US_Cust='MYR', 1/3,if(US_Cust='EU',1.5, 1))) * curren)

,'###,##0.00')

So that it is easy for me to manage.

Paul

paulyeo11
Valued Contributor III

Re: After insert ,if(US_Cust='MYR',1/3, 1) the expression not more working

Hi Anil

I try and i get it :-

'S$ ' &Num(

sum(If ( US_Cust='USD', 1,If ( US_Cust='MYR', 1/3,if(US_Cust='EU',1.5, 1))) * curren+days3+days6+days9+above12)

,'###,##0.00')

Paul