Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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)
Can you share a screenshot
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.
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)

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
Can you remove the highlighting, so that we can see the error?

You seem to have parenthesis before if... these seems to be unnecessary... may be you are not closing them correctly?
Check the parenthesis but still continue the error I do not know if it is because I use two applymap of different fields.
