Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Team | Group | Name | DOB | Country and Club | Continent |
Australia | C | Daniel Arzani | 1999-01-04 | Australia Melbourne City | Asia |
France | C | Kylian Mbappé | 1998-12-20 | France Paris Saint-Germain | Europe |
Morocco | B | Achraf Hakimi | 1998-11-04 | Spain Real Madrid | Africa |
Nigeria | D | Francis Uzoho | 1998-10-28 | Spain Deportivo Fabril | Africa |
England | G | Trent Alexander-Arnold | 1998-10-07 | England Liverpool | Europe |
Senegal | H | Moussa Wagué | 1998-10-04 | Belgium Eupen | Africa |
Hi Qlik Sense experts,
How are you today? I would like to add an additional column named 'Continent'
if Team ='France' or Team = 'England' then Contenent = 'Europe'
if else Team ='Morocco' or Team = 'Senegal then Contenent = 'Africa'
if else Team ='Australia' then Contenent = 'Asia'
End if as Continent
How can I write a similar Qlik scripts to populate additional column as the above syntax?
Many Thanks and kind regards,
Feng
One way of solving this is using Pick(Match()) like I've done below.
Pick( Match([Team],'Australia', 'France', 'Morocco','Nigeria','England','Senegal'),
'Asia', 'Europe', 'Africa', 'Africa, 'Europe', 'Africa') as Continent
]
Hi Regar,
Thanks for your kind help and prompt response, the point is that there are 32 soccer teams in the world cup, and around few thousands of soccer players, we can not use match() to manually fill in the Nations and continents for each player.
I am wondering if there is any chance to get a extra column to flag its continent.
Many Thanks
Regards,
Feng Gao
Please try using Mapping load as below, in this case all you need to do is have an excel updated with all Countries and Continents, the rest will work seamlessly
Map_Continent:
Mapping Load * Inline
[Country,Continent
France,Europe
England,Europe
Morocco,Africa
Senegal,Africa
Australia,Asia
Spain,Africa
Belgium,Africa
];
Data:
Load *,
SubField([Country and Club],' ',1) as Test,
applymap('Map_Continent',SubField([Country and Club],' ',1) ,'NA') as Cont_Test;
load * Inline [
Team,Group, Name,DOB,Country and Club,
Australia,C, Daniel Arzani, 1999-01-04, Australia Melbourne City
France, C, Kylian Mbappé, 1998-12-20, France Paris Saint-Germain
Morocco, B, Achraf Hakimi, 1998-11-04, Spain Real Madrid
Nigeria, D, Francis Uzoho, 1998-10-28, Spain Deportivo Fabril
England, G, Trent Alexander-Arnold, 1998-10-07, England Liverpool
Senegal, H, Moussa Wagué, 1998-10-04, Belgium Eupen
];
I'm not listing the Continent for each player in my example, I'm listing for each country. (I've updated my previous answer with color coding and intendation to make my approach more readable).
The pick match is an quite quick approach when you have a few dimensions to match, but if you are planning for mapping all countries to a continent then I suggest you go with @anushree1 approach using ApplyMap.
Did any of the posts get you what you needed? If so, do not forget to return to the thread and close things out by going to the post that helped and using the Accept as Solution Button to mark, which also gives the poster credit for the help and lets other Members know what worked. If you are still working on things, please leave an update. I do believe we did a Demo app on World Cup as well, which you should be able to find at https://demo.qlik.com/qlikview.
Regards,
Brett