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: 
Anonymous
Not applicable

if then else in subfeild function

Hi Team,

Currently we are using the below code to achieve : SUITMQLAP <-- text in frontend

It should only pick till SUITMQLAP

replace(left(if(index(PCNumber,'_')>0,trim(subfield(PCNumber,'_',1)),

    rtrim(subfield(PCNumber, 'QLAP', 1))&'QLAP'),11), ' ', '') as LaptopNo

Now we require that the SUITMQLAP text should pick US text as well means

I require desire result as SUITMQLAPUS

Could please send me the code for this : SUITMQLAPUS

5 Replies
tamilarasu
Champion
Champion

Hi Manisha,

Replace(Left( If(Index(PCNumber,'_')>0, Trim(Subfield(PCNumber,'_',1)),

         RTrim(Subfield(PCNumber, 'QLAP', 1)) & If(Index(PCNumber,'QLAPUS')>0, 'QLAPUS','QLAP')) ,11), ' ', '') as LaptopNo

Anonymous
Not applicable
Author

Hi,

It does not solve my issue:

I require that it should pick both of the scenario QLAP as well as QLAPUS .

Still when I try to filter on laptop it doesnot show QLAPUS .

Regards

tamilarasu
Champion
Champion

Try this,

Replace( Left( If(Index(PCNumber,'_')>0,Trim(SubField(PCNumber,'_',1)),

          If(WildMatch(PCNumber,'*QLAP*','*QLAPUS*')>0, RTrim(SubField(PCNumber, 'QLAP', 1)) & 'QLAP')) ,11) , ' ', '') as LaptopNo

pradosh_thakur
Master II
Master II

what is the field values for PC number? post 2-3 values . May be you dont need this complex expression?

Learning never stops.
Anonymous
Not applicable
Author

Hi ,

Please find the some eg:

1. First Scenerio it should consider : PCSRSQLAP_ABRTI00003006668L1802240648

2. Second Scenerio it should consider US aswell : PCSRSQLAPUS_ABRTI00003006668L1802240648

3. Third Scenerio it should Consider other QLAP also means PCRM : PCSRSPCRMUS_ABRTI00003006668L1802240648.

Kindly let me know now how we can code this.