Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik Insider: SaaS capabilities for Data Integration and Analytics, May 25th! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
deep2021
Creator II
Creator II

If \ or conditions in the script

Hi All,

 

I have a number of if statements like below,

 

 

if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),'ZERO','NOT ZERO') as STATUS,
if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),0,BEG_BAL) as BEG_BAL_1,
if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),0,END_BAL) as END_BAL_1,
if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),0,ACTIVITY) as ACTIVITY_1

 

 

Could you please suggest how to move ahead to get the optimize results.

Thanks in advance!!

 

Thanks

1 Solution

Accepted Solutions
marcus_sommer
MVP & Luminary
MVP & Luminary

I'm not quite sure what you mean but you wouldn't need to do the check for each field else you may use a preceeding load like:

load *,  pick(Check, 'ZERO', 'NOT ZERO') as STATUS, pick(Check, 0, BEG_BAL) as BEG_BAL_1, ...;
load *, if(wildmatch(...) or index(...)>1, 1, 2) as Check from Source;

Whereby if there are many of such matchings I would in general look to avoid and/or minimize them and/or to apply rather join/mapping/association approaches as creating duplicate information in extra fields.

- Marcus 

View solution in original post

7 Replies
deep2021
Creator II
Creator II
Author

Hello Experts,

 

Can you please suggest on this.

Thanks in advance!!!

 

Thanks

deep2021
Creator II
Creator II
Author

@sunny_talwar - Please help

Seyko
Partner
Partner

Hello,

Create a flag for the values which match with your conditions in your statements (especially second one). Create a  LOAD INLINE table (with your criterias ) and use it like a mapping table (Applymap()) . I hope it'll be helpful for you.

Regards.

Excuse my english, i'm french!
deep2021
Creator II
Creator II
Author

Thanks for your inputs.

Can you please share an example for the same?

marcus_sommer
MVP & Luminary
MVP & Luminary

Take a look on the following postings:

Mapping … and not the geographical kind - Qlik Community - 1494869

What is a Mapping Load in Qlikview - Qlik Community - 1481005

and be not impatient if you need a few days to go through all possibilities carefully. Mapping is an essential way of categorize, clean, flag or match the data and usually also the easiest and most suitable & performant approach for it. So it's worth to comprehend the logics.

- Marcus

deep2021
Creator II
Creator II
Author

Hi Marcus,

 

Thanks for the valuable response. For the below code, is it possible to create the calculated column in the resident load for WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*') and use the same in the script.

 

if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),'ZERO','NOT ZERO') as STATUS,
if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),0,BEG_BAL) as BEG_BAL_1,
if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),0,END_BAL) as END_BAL_1,
if(WildMatch(PLSR_Footnote_temp,'*D*') OR (INDEX(PLSR_Footnote_temp,'*')>1),0,ACTIVITY) as ACTIVITY_1

 

Please suggest

 

marcus_sommer
MVP & Luminary
MVP & Luminary

I'm not quite sure what you mean but you wouldn't need to do the check for each field else you may use a preceeding load like:

load *,  pick(Check, 'ZERO', 'NOT ZERO') as STATUS, pick(Check, 0, BEG_BAL) as BEG_BAL_1, ...;
load *, if(wildmatch(...) or index(...)>1, 1, 2) as Check from Source;

Whereby if there are many of such matchings I would in general look to avoid and/or minimize them and/or to apply rather join/mapping/association approaches as creating duplicate information in extra fields.

- Marcus