Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to pass field name into expression?

I wanted to pass a field name into expression to make the expression dynamic. The field name is in a listbox filled by inline code. So far, no success.

Here is the example. The field name is Readmit14 and Count(Readmit14)  returns 15. When I pass the field name (%Metrics) using the list box which only allows single selection, result is 1 even the field name selected is Readmit14. Count(%Metrics)=1. How can I do it?

Thanks

Longmatch

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Have a look at the attached example.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
udit_kumar_sana
Creator II
Creator II

Hi,

You can write below expression in Chart expression tab,in conditional expression:

-For Readmit14:      SubStringCount(Concat(Exp,'|'),'Readmit14')

Similarly

-For %Metrics:         SubStringCount(Concat(Exp,'|'),'%Metrics')

-Here Exp is filed name to be cretaed by Inline.

-It contains all values of expression name you need to display in chart i.e. Readmit14,%Metrics .... so on.

-calculate the expressions as per there original Kpi fields.

-By using above expressions intially table will show all expressions.

-On selecting particular expression from Exp listbox it will show only that expression in the chart.

Regards,

Udit



kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Have a look at the attached example.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

I used your method still cannot get it to work. Here are the inline code I used: there is only one column in your sample, but my project has 3. I created a variable (Metrics), make it equal to %Metrics and used $(Metrics) in expression. not working.

LOAD * INLINE [

%Metrics, %Intervention, %Fuallname

CXR, Intervention, Chest x-ray

OrderSet, OrderSetIntervention, Order set utilization

IPOrderSet, OrderSetIntervention, IP Order set utilization

ECOrderSet, OrderSetIntervention, EC Order set utilization

Readmit31, OrderSetIntervention, 31 day Readmission

Readmit14, OrderSetIntervention, 14 day Readmission

Readmit7,  OrderSetIntervention, 7 day Readmission

];

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Did u put '=' sign in your variable? It is important

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!