Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ujji
Contributor II
Contributor II

Error in the Query

Hello Everyone,

Recently, i have been trying to implement and following were the Result anticipated:

Expected Result:

GSKG Artikel   
60 82xx xxxx xxx 103002
60 84xx xxxx xxx 103002
60 90xx xxxx xxx 103002
60 8700 0001 001 103002
60 8900 0082 001 103002
60 8900 0082 002 103002
60 8900 0082 003 103002
60 8900 0082 004 103002
   
GSKG all Artikel 103001

 

The query that i wrote was:

if((Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1)=6082 and Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1)=6084
and Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1) =6090 and If(WildMatch(GSKG_Zufu_Artnum,6087000001001),103002,If(WildMatch(GSKG_Zufu_Artnum,6089000082001),
If(WildMatch(GSKG_Zufu_Artnum,6089000082002),103002,If(WildMatch(GSKG_Zufu_Artnum,6089000082003),103002,
If(WildMatch(GSKG_Zufu_Artnum,6089000082004),103002,Text(103001))))))) as Zufu_WeBuDaten_Leer_E1MARCM_PRCTR,

 

While loading the Data, it fetches an Error in these lines. 

Could anyone please go through once my query and Required Result and suggest me or clarify me the mistake i am making?

Thanks in advance.

Labels (4)
7 Replies
Nicolae_Alecu
Creator
Creator

Hello @ujji ,

In first place, I'm not sure if you need 2 parenthesis after IF(( at the beginning , but I don't know how do you want to evaluate your conditions.

Your first 3 conditions will always be false because you have First number = 6082 , etc. 
Maybe you want to use Left(...,4) 


Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1)=6082 and
Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1)=6084 
and
Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1) =6090 

My guess is that after this line, you want to make a Then expression which means you have to use a comma, not another "and" .

 

Please give more information about what do you expect from the code.

 

Best Regards,

BrunPierre
Partner - Master
Partner - Master

Hi, try

Text(If(Match(Left(KeepChar([GSKG Artikel],'0123456789'), 4),'6082','6084','6090','6087','6089') ,'103002','103001')) as Zufu_WeBuDaten_Leer_E1MARCM_PRCTR

ujji
Contributor II
Contributor II
Author

@Nicolae_Alecu :

Thank you for your reply and suggestion. You are absolutely right about it.

I tried the corrected method which you suggested and the  following code looks like this:

If(Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),4) = 6082 or
Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1)=6084 or
Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),1) =6090 or
WildMatch(GSKG_Zufu_Artnum,6087000001001) or
WildMatch(GSKG_Zufu_Artnum,6089000082001) or
WildMatch(GSKG_Zufu_Artnum,6089000082002) or
WildMatch(GSKG_Zufu_Artnum,6089000082003 or
WildMatch(GSKG_Zufu_Artnum,6089000082004), 103002, 103001) as Zufu_WeBuDaten_Leer_E1MARCM_PRCTR,

 

However, the Error still persists. The result that i shared in my first message is the desired result.

Thanks,

Nicolae_Alecu
Creator
Creator

Hello @ujji ,

I think this might work: 

If(Match(Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),4),6082,6084,6090) or
WildMatch(GSKG_Zufu_Artnum,6087000001001,6089000082001,6089000082002,6089000082003,6089000082004),
103002, 103001)
as Zufu_WeBuDaten_Leer_E1MARCM_PRCTR

 

I have this output:

Nicolae_Alecu_0-1713519007201.png

 

Nicolae_Alecu
Creator
Creator

Or maybe this:

Code:

If(Match(Left(KeepChar(GSKG_Zufu_Artnum,'0123456789'),4),6082,6084,6090) or
WildMatch(KeepChar(GSKG_Zufu_Artnum,'0123456789'),'*6087000001001*','*6089000082001*','*6089000082002*','*6089000082003*','*6089000082004*'),
103002, 103001)
as Zufu_WeBuDaten_Leer_E1MARCM_PRCTR

 

 

Output:

Nicolae_Alecu_1-1713519307029.png

 

ujji
Contributor II
Contributor II
Author

@Nicolae_Alecu : This helped me resolving the issue. Thank you ver much

ujji
Contributor II
Contributor II
Author

@BrunPierre This solution also worked. One must be careful with the type of the function. Your suggestion is with the Text function. One can also use it as Num# function.