Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tan_chungkam
Creator
Creator

Grouping Value

Hi Qlikers,

I trying to group certain value into different group.

Is there anyway to shorten or replace below scripting in order  to avoid long typing time.

clipboard_image_0.png

4 Replies
Quy_Nguyen
Specialist
Specialist

I suggest using the ApplyMap function:https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Ma...

You can create a map like this, or load from file:

GroupMap:
Mapping Load * inline
[
Name, Group
Apple,1
Coconut,1
Dragonfruit,1
Elephant,2
Fox,2
Gold,2
];

Then use this line to get group:

ApplyMap('GroupMap',Name,'N/A') as Group

 

 

tan_chungkam
Creator
Creator
Author

Hi @Quy_Nguyen ,

Thanks for your quick response.

This seem better than what i using at the moment.

Just another question - what if i have more than 20 line of that?

 

Quy_Nguyen
Specialist
Specialist

Hi,

As I said, you could use a file to manage it. For future changes, you just have to update the file instead of making any change in your script.

StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

maybe

SET vGroup1 = 'Apple','Banana','Coconut','Dragonfruit','Elephant';

SET vGroup2 = 'Fox','Gold';

If(Match(Name,$(vGroup1))>0,'1', If(Match(Name,$(vGroup2))>0,'2')) as Group