Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Creator III
Creator III

Re: Grouping Value

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

 

 

Highlighted
Creator
Creator

Re: Grouping Value

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?

 

Highlighted
Creator III
Creator III

Re: Grouping Value

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.

Highlighted
Partner
Partner

Re: Grouping Value

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