Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello friends,
Please find the below Script (Apply Map). I am encountering error in it. I just want to give short names to the region. Please help me on this.
ChangeMap1:
Mapping LOAD * INLINE [
ChangeType, ChangeName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA];
ApplyMap('ChangeMap',"Region") as [Change in Categories],
HAPPY NEW YEAR TO ALL....
Hi Viswanathan,
Advance happy new year!!
your requirement was not clear,but what my assumption is you want short names in
[Change in Categories] Field.
Try this in script:
ChangeMap1:
Mapping LOAD *
INLINE [
ChangeType,ChangeName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA];
new table:
load *,
ApplyMap('ChangeMap1',ChangeType,'Not Found') as [Change in Categories]
INLINE [
ChangeType
ASIA
NORTH AMERICA
EUROPE
SOUTH
SOUTH AMERICA
];
By this you can get
--Surendra
1) You have given Mapping Table name ChangeMap1 and you are using ChangeMap
2) You are using Region within double quote.. You just need to use Region without any quote.
ChangeMap1:
Mapping LOAD * INLINE [
ChangeType, ChangeName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA];
//Wrong... ApplyMap('ChangeMap',"Region") as [Change in Categories]
//below one is correct.. and should work.
ApplyMap('ChangeMap1',Region,'NotFound') as [Change in Categories]
Go through below link to understand more on ApplyMap.
Don't join - use Applymap instead
https://www.quickintelligence.co.uk/applymap-is-it-so-wrong
Happy Qliking..
Regards,
MK
Manish -
I don't think point number 2 should be a concern. I think double quotes behaves just like square brackets in the script. Tested this with surendraj's script
ChangeMap1:
Mapping LOAD *
INLINE [
ChangeType,ChangeName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA
];
Table:
LOAD *,
ApplyMap('ChangeMap1', "ChangeType",'Not Found') as [Change in Categories]
INLINE [
ChangeType
ASIA
NORTH AMERICA
EUROPE
SOUTH
SOUTH AMERICA
];
and had no issues running the above. I think the only concern was the name mis-match of the tables.
Sorry friends,
I have not asked my doubt clearly it seems, Consider, in the below table I am having Dist Region and Sales. When I make a PIE chart out of this, the name of the region should be in short forms (Asia, EU, NA, SA). Hope now I am clear with my question.
Dist Region | Sales |
NORTH AMERICA | 20000 |
EUROPE | 10000 |
ASIA | 60000 |
SOUTH AMERICA | 20000 |
Thank you, friends
Now the Time here is 11:55 PM.... Happy New year... May this New year bring you Happiness with long life.
Try this :
Mapping LOAD * INLINE
[
ChangeType, ChangeName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA] ;
Load *,
ApplyMap('ChangeMap','Region') as Change_in_Categories
;
Hi Surendra Javvaji,
Thanks for yyour reply. I tried your script, the result is shown below
Before it was like the below image,
This worked for me.
Thank you once again Sunny..
I think the issue is with your string, one charachter doesn't match and applymap won't work.
LOAD following table without mapping load and don't use applymap
RegionShortName:
LOAD * INLINE [
Region,ShortName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA
];
In UI create a table with Region, ShortName and Sum(Sales)
Share your output here.
Thanks for your support Shubham Singh
I used the below mentioned script and i worked great.
ChangeMap1:
Mapping LOAD * INLINE [
ChangeType, ChangeName
ASIA, ASIA
NORTH AMERICA, NA,
EUROPE, EU
SOUTH AMERICA, SA];
Load *,
ApplyMap('ChangeMap1',"Dist Region",'NotFound') as [Change in Categories]
INLINE [
"Dist Region"
ASIA
NORTH AMERICA
EUROPE
SOUTH
SOUTH AMERICA
];