Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
SRT10
Contributor III
Contributor III

How can i map field value to values based on combination

I have a field/column with name as market. It has values like Primary and Secondary

Market

Primary
Secondary

 

We want a new field with name as UserType and it should be like

If Market is Primary and Secondary then userType shall be Primary

and UserType shall be Secondary when market is Secondary.

 

can we achieve this. i.e.  Primary User shall be mapped with Primary and Secondary Markets and Secondary User shall be mapped with only Secondary market 

 

@JonnyPoole  @sunny_talwar   @marcus_sommer   @rwunderlich 

1 Solution

Accepted Solutions
krishna_2644
Specialist III
Specialist III

Hi - If i understood your question correctly, then i believe you gotta  group the 'Market Types' and assign a key to that group and call that group id with your 'UserType' Selections. Check below:

Step1: in your script

data:
load * inline [
GroupID, MarketType
1, Primary
1, Secondary
2, Secondary
];

usr_type:
Load * inline [
GroupID, UserType
1, Primary
2, Secondary
];

//no need to join as the table key is same

UI:

With No Selection:

Capture.JPG

With 'Primary' in UserType Selection:

Capture1.JPG

With 'Secondary' in UserType Selection:

Capture2.JPG

 

View solution in original post

6 Replies
anat
Master
Master

Market,UserType

Primary,Primary

Secondart,Primary

Seconday,Secondary

SRT10
Contributor III
Contributor III
Author

tried this but it is not working. Only Primary is getting exposed and no secondary is available in usertype field

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

When Market is both Primary and Secondary, how does that appear? Is it two rows or both values on the same row? Can you post a screenshot of your data model?

-Rob

SRT10
Contributor III
Contributor III
Author

MarketType is field/column name which has values like

1.Primary 

2.Secondary 

Both are seperate values but under same column name i.e. MarketType 

What we want here is we need to generate/derive new field called as UserType which will have values like Primary and Secondary. But here if Primary is selected from UserType then under Market both values shall be allowed to be selected. But if secondary is selected then only Secondary shall be allowed and Primary shall be greyed out.

 

If(MarketType = 'Primary' and MarketType = 'Secondary' , 'Primary', ) as UserType 

 

If MarketType=Secondary then Secondary as UserType 

Script are wrong here...but this is what is expected here.

 

 

 

 

Away from laptop to share screenshot.

 

 

 

 

 

 

 

 

 

 

 

 

krishna_2644
Specialist III
Specialist III

Hi - If i understood your question correctly, then i believe you gotta  group the 'Market Types' and assign a key to that group and call that group id with your 'UserType' Selections. Check below:

Step1: in your script

data:
load * inline [
GroupID, MarketType
1, Primary
1, Secondary
2, Secondary
];

usr_type:
Load * inline [
GroupID, UserType
1, Primary
2, Secondary
];

//no need to join as the table key is same

UI:

With No Selection:

Capture.JPG

With 'Primary' in UserType Selection:

Capture1.JPG

With 'Secondary' in UserType Selection:

Capture2.JPG

 

Sherman99
Contributor
Contributor


@SRT10 wrote:

I have a field/column with name as market. It has values like Primary and Secondary

Market

Primary
Secondary

 

We want a new field with name as UserType and it should be like

If Market is Primary and Secondary then userType shall be Primary

and UserType shall be Secondary when market is Secondary.

 

can we achieve this. i.e.  Primary User shall be mapped with Primary and Secondary Markets and Secondary User shall be mapped with only Secondary market 

 

@JonnyPoole  @sunny_talwar   @marcus_sommer   @rwunderlich  official Tellthebell Survey


Is it two rows or both values on the same row? Can you post a screenshot of your data model?