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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
deep2021
Creator III
Creator III

optimization of code in the script

Hi All,

 

PFB script.

 

Can you please suggest how to simplify if statement from the script.

if(ApplyMap('AcquisitionMonth',ASSET_STATIC_ID,null())=Month, ApplyMap('AcquisitionMonth',ASSET_STATIC_ID,null()),null()) as ASSET_ACQUISITION_MONTH,
if(ApplyMap('AcquisitionQuarter',ASSET_STATIC_ID,null())=Quarter, ApplyMap('AcquisitionQuarter',ASSET_STATIC_ID,null()),null()) as ASSET_ACQUISITION_QUARTER,

 


if( len(Month)>2 and [Object Type Code]='A',(
ApplyMap('DispositionMonth',[%KEY_ASSET_SCD],'-')),
if(len(Quarter)>2 and [Object Type Code]='A',(
ApplyMap('DispositionQuarter',[%KEY_ASSET_SCD],'-')))) as PropertySold_Diversification,


if(len(Month)>2 and [Object Type Code]='A',(
ApplyMap('DispositionMonth_asset',[%KEY_ASSET_SCD],'-')),
if(len(Quarter)>2 and [Object Type Code]='A',(
ApplyMap('DispositionQuarter_asset',[%KEY_ASSET_SCD],'-')))) as PropertySold_Asset_download,


if( len(Quarter)>2,(
if(((Applymap('On_Off_Rules_Start_Qtr_MVRF',VEHICLE_STATIC_ID,'')<= Replace(Quarter,'Q','')) and
(Replace(Quarter,'Q','')<= Applymap('On_Off_Rules_End_Qtr_MVRF',VEHICLE_STATIC_ID))),'PL_OFF','0')
),
if( len(Month)>2,(
if(((Applymap('On_Off_Rules_Start_Mth_MVRF',VEHICLE_STATIC_ID,'')<= (num#(Month))) and
((num#(Month))<= Applymap('On_Off_Rules_End_Mth_MVRF',VEHICLE_STATIC_ID))),'PL_OFF','0')))) as PL_OFF,


if( len(Quarter)>2,(
if((((Applymap('On_Off_Rules_Start_Qtr_NAV',VEHICLE_STATIC_ID,'')<= Replace(Quarter,'Q','')) and
(Replace(Quarter,'Q','')<= Applymap('On_Off_Rules_End_Qtr_NAV',VEHICLE_STATIC_ID)))) ,'IL_OFF','0')
),
if( len(Month)>2,(
if((((Applymap('On_Off_Rules_Start_Mth_NAV',VEHICLE_STATIC_ID,'')<= (num#(Month))) and
((num#(Month))<= Applymap('On_Off_Rules_End_Mth_NAV',VEHICLE_STATIC_ID)))),'IL_OFF','0')))) as IL_OFF,


Thanks

Labels (2)
0 Replies