Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
kishorj1982
Creator II
Creator II

Removing repetative calculations from qlik script.

Hi All,

 

I have some different filter conditions in my where condition but my original table size is huge due to that it is not feasible to load the same table again and again.

 

Can you please suggest on this, I have attached the script for your reference.

 

 

Regards,

Kishor. 

5 Replies
rubenmarin

Hi, I think it will be faster reading only one time from qvd and doing the checks to fill [Engineering Category Status] and [Engineering Category] in each record.
kishorj1982
Creator II
Creator II
Author

Can you please share an example.

 

Thanks

rubenmarin

Hi, it will be moving the 'where' conditions of each load to an if, like:
// Preceding LOAD to assign values based on 'KeyField' combination; just an example better if mapsubstring is used
// https://help.qlik.com/es-ES/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Ma...
LOAD *
If(Subfield(KeyField, '-', 1)='UP', 'Unprocessed') as [Engineering Category Status],
If(Subfield(KeyField, '-', 2)='EOE', 'Electrical Order Engineering') as [Engineering Category]
;
LOAD,
If( // UP-EOE: Check for Uprocessed - Electrical Order Engineering
EEPR = ' '
AND EEED = ' '
AND EDFR = ' '
AND (ANT01 = 'SPECIAL' OR ANT02 = 'SPECIAL' OR ANT03 = 'SPECIAL' OR ANT04 = 'SPECIAL')
AND ApplyMap ('Electrical Order Engineering Material Exclude Map', ApplyMap ('Engineering Category Plant', [Sales Document Item Key], Null ()) & ' ' & ApplyMap ('Engineering Category Material', [Sales Document Item Key], Null ()), Null ()) = 'N', 'UP-EOE',
// UP-EPE: Check for Unprocessed - Electrical Production Engineering
(EEED = 'X' OR (ANT01 <> 'SPECIAL' AND ANT02 <> 'SPECIAL' AND ANT03 <> 'SPECIAL' AND ANT04 <> 'SPECIAL'))
AND EEUN = 'X'
AND EEFR = ' '
AND EDFR = ' '
AND ApplyMap ('Electrical Production Engineering Material Exclude Map', ApplyMap ('Engineering Category Plant', [Sales Document Item Key], Null ()) & ' ' & ApplyMap ('Engineering Category Material', [Sales Document Item Key], Null ()), Null ()) = 'N',
// Next case...
)) as KeyField
kishorj1982
Creator II
Creator II
Author

Thanks.

But this does not work here properly and my results are not matching.

 

 

kishorj1982
Creator II
Creator II
Author

Hello Experts,

Can you please suggest on this.

 

Thanks