Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
shivam0703
Contributor III
Contributor III

how to use pick and match with field name not a string

I want to optimize nested if function so I am trying  pick and match function.

need to convert below expression: 

if
(
Current_Level = 5,
'P(District_Hierarchy_S_Name)',
if
(
Current_Level = 3,
'P(Region_Hierarchy_S_Name)',
if
(
Current_Level = 2,
'P(OEM_Hierarchy_S_Name)',
'P(OEM_Hierarchy_S_Name)'
)
)
)

I tried this: Pick(Match(Current_Level, 5,3)+1, OEM_Hierarchy_S_Name, District_Hierarchy_S_Name, Region_Hierarchy_S_Name)

 

Can anyone help me with this???

1 Solution

Accepted Solutions
Kush
MVP
MVP

@shivam0703  I just referred your original expression where you have condition for level=2 and you also used quotes in so I thought you already using it in same . If you don't want that way try below

Pick(Match(Current_Level, 5,3)+1, 
OEM_Hierarchy_S_Name,
District_Hierarchy_S_Name,
Region_Hierarchy_S_Name)

View solution in original post

3 Replies
Kush
MVP
MVP

@shivam0703  try below

Pick(Match(Current_Level, 5,3,2)+1, 
'P(OEM_Hierarchy_S_Name)',
'P(District_Hierarchy_S_Name)',
'P(Region_Hierarchy_S_Name)',
'P(OEM_Hierarchy_S_Name)')
shivam0703
Contributor III
Contributor III
Author

@Kush  why are you adding 2 and its condition because for cureent_level =2 or any other apart from 3 and 5 it gives same as P(OEM_Hierarchy_S_Name) so no need to add 2 and one more doubt if I use in single quote then it will take it as a string an but I have a filed name 'P(District_Hierarchy_S_Name)',

here District_Hierarchy_S_Name is a field name bt if u use inside ' ' then it will take as a string

Kush
MVP
MVP

@shivam0703  I just referred your original expression where you have condition for level=2 and you also used quotes in so I thought you already using it in same . If you don't want that way try below

Pick(Match(Current_Level, 5,3)+1, 
OEM_Hierarchy_S_Name,
District_Hierarchy_S_Name,
Region_Hierarchy_S_Name)

View solution in original post