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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
jagjivvt
Creator
Creator

Help with Load Script

Hi

i am applying the script below but it does not work, please provide me with a solution as it works perfect in excel as shown below.

'=IF(O2<0,"Expenses",IF(AND(L2="BGC",RIGHT(G2,6)<>"602210"),"Cheques other",IF(AND(G2="MANPOWER UK LTD",LEN(H2)=3),"Cashbook",IF(AND(L2="IBP",I2="Manpower UK LTD"),"Cashbook",IF(AND(OR(L2="CHP",L2="IBP"),LEN(I2)=0),G2,IF(OR(L2="CHP",L2="IBP"),I2,G2))))))

=

if(Amount <= '0', 'Expenses', if (Type = 'BGC' + right([Narrative #1], 6)<> '602210'

),

'Cheques Other'

, if ([Narrative #1] = 'MANPOWER UK LTD' + LEN([Narrative #3]) = '3', 'Cashbook'

,

if

(Type = 'IBP' + [Narrative #3] = 'MANPOWER UK LTD'), 'Cashbook', if(or(Type = 'CHP', Type = 'IBP'

)+

len

([Narrative #3] = '0', [Narrative #1], if(or(Type = 'CHP', Type = 'IBP'), [Narrative #3], [Narrative #1]))))) as [New Narrative]

,

thanks

vijay





1 Solution

Accepted Solutions
tseebach
Partner - Creator III
Partner - Creator III

Instead of the OR() function you can use Match('Field',value1,value2,etc) If any value is found it will return true.

I would suggest that you cut down the formula into smaller parts. A bit like setting some flags. And then have them all put together in the expression dialog for your charts. It make you code cleaner and more flexible.

Although precalculations is always nice 😉

View solution in original post

2 Replies
Not applicable

The first is Excel and the second is using the same logic in your Load Script?

First, you use and inside if statements.

if (Type = 'BGC' and right([Narrative #1], 6)<> '602210'


I also don't think there is an or() function, use:

if(Type = 'CHP' or Type = 'IBP'


It would also be a lot easier to read the expression if you pasted it as plain text inside [ code] [ /code] tags (without the spaces).

tseebach
Partner - Creator III
Partner - Creator III

Instead of the OR() function you can use Match('Field',value1,value2,etc) If any value is found it will return true.

I would suggest that you cut down the formula into smaller parts. A bit like setting some flags. And then have them all put together in the expression dialog for your charts. It make you code cleaner and more flexible.

Although precalculations is always nice 😉