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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
gr_eldred
Creator II
Creator II

Wildmatch()

Good afternoon I have an error with the use of this Wildmatch when reloading data tells me that the syntax is incorrect is it possible to do this? What could be another option?

if( WildMatch( ApplyMap('Map_Clasific_art', %Art_ID,'N/A'), 'Iphone' ) and WildMatch( ApplyMap('Map_Subclasific_art', %Art_ID,'N/A'), 'iPhone 6', 'iPhone 6 Plus', 'iPhone 6S', 'iPhone 6S Plus', 'iPhone 7', 'iPhone 7 Plus', 'iPhone SE') , sum(Cantidad)

Labels (1)
20 Replies
sunny_talwar
MVP
MVP

Can you share a screenshot

felipedl
Partner - Specialist III
Partner - Specialist III

As Sunny sugested, I believe you're missing a group by clause in your code.

This is what I tested

Mapping

Map_Clasific_art:

Load * inline

[

ID,Desc

1,Iphone

2,Android

];

Mapping

Map_Subclasific_art:

Load * inline

[

ID,Desc

1,iPhone 6

2,iPhone 6 Plus

3,iPhone 6S

4,iPhone 6S Plus

5,iPhone 7

6,iPhone 7 Plus

7,iPhone SE

8,Samsung J5

9,Samsung J7

];

data:

load * Inline

[

%Art_ID,Cantidad

1,1

2,2

3,3

4,4

5,5

6,1

8,10

9,100

];

temp:

Load

Type,

SubType,

if( WildMatch( Type, 'Iphone' ) and WildMatch( SubType, 'iPhone 6', 'iPhone 6 Plus', 'iPhone 6S', 'iPhone 6S Plus', 'iPhone 7', 'iPhone 7 Plus', 'iPhone SE') , sum(Cantidad) ,0) as cuota

group by Type,SubType;

Load

%Art_ID,

ApplyMap('Map_Clasific_art',%Art_ID,'N/A') as Type,

ApplyMap('Map_Subclasific_art',%Art_ID,'N/A') as SubType,

Cantidad

Resident data;


drop table data;

And it works fine (data may not make sense, but it works).

Felipe.

gr_eldred
Creator II
Creator II
Author

Of course for what is selected, in the penultimate if it is where I am interested to know if it is correct to have an and between two wildmatch

If (WildMatch (ApplyMap ('Map_Clasific_art',% Art_ID, 'N / A'), 'Iphone') y WildMatch (ApplyMap ('Map_Subclasific_art',% Art_ID, 'N / A' 6 Plus ',' iPhone 6S ',' iPhone 7 ',' iPhone 7 Plus ',' iPhone SE '), sum (Cantidad)

gr_eldred
Creator II
Creator II
Author

clasificacion.png

its_anandrjs
Champion III
Champion III

Kindly check the fields that are used in the SUM() expression will they also used in the Group By or not if not you get this error and also rather than using Applymap inside of the SUM() you can used it before sum in the same field or you can use it by flagging on field and used on the expression.

Ex:-

Load

Id,Name,

Sum(Sales) as TotalSales

From Source

Group by

Id, //This is Important

Name; //This is Important


sunny_talwar
MVP
MVP

Can you remove the highlighting, so that we can see the error?

gr_eldred
Creator II
Creator II
Author

clasificacion1.png

sunny_talwar
MVP
MVP

You seem to have parenthesis before if... these seems to be unnecessary... may be you are not closing them correctly?

Capture.PNG

gr_eldred
Creator II
Creator II
Author

Check the parenthesis but still continue the error I do not know if it is because I use two applymap of different fields.

gr_eldred
Creator II
Creator II
Author

clasificacion1.png