Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
jimgibson
Contributor
Contributor

Substitute a variable into an expression

 

In what I have below, how do I substitute the value of vCHMetricToUse into eCHMetricEncounterCNT and eCHMetricMedian ?

 

Set vCHMetricToUse=A-AD;
Set eCHMetricEncounterCNT= Count([PatientEncounterID]) - NullCount([A-AD]);
Set eCHMetricMedian=Median([A-AD]);
Set vCHMetric=Door to Admit Throughput; 

 

Thanks in Advance

1 Solution

Accepted Solutions
swuehl
MVP
MVP

If you want the replacement to happen when the script executes, you can use a dollar sign expansion:

Set vCHMetricToUse=A-AD;

Set eCHMetricEncounterCNT= Count([PatientEncounterID]) - NullCount([$(vCHMetricToUse)]);

Set eCHMetricMedian=Median([$(vCHMetricToUse)]);

Set vCHMetric=Door to Admit Throughput;

If you need the replacement to happen in the front end (i.e. you want to change vCHMetricToUse also in the front end, try

Set vCHMetricToUse=A-AD;

LET eCHMetricEncounterCNT= 'Count([PatientEncounterID]) - NullCount([$' & '(vCHMetricToUse)])';

LET eCHMetricMedian='Median([' & '$(vCHMetricToUse)])';

Set vCHMetric=Door to Admit Throughput;

OR

Set vCHMetricToUse=A-AD;

LET eCHMetricEncounterCNT= Replace('Count([PatientEncounterID]) - NullCount([@(vCHMetricToUse)])','@','$');

LET eCHMetricMedian= Replace('Median([@(vCHMetricToUse)])','@','$');

Set vCHMetric=Door to Admit Throughput;

The Magic of Dollar Expansions

The Magic of Variables

Stop Dollar Sign Expansion in the script (Escape Character ??? )

View solution in original post

3 Replies
sunny_talwar

May be this:

Set vCHMetricToUse=A-AD;
Set eCHMetricEncounterCNT= Count([PatientEncounterID]) - NullCount(vCHMetricToUse);
Set eCHMetricMedian=Median(vCHMetricToUse);
Set vCHMetric=Door to Admit Throughput;

jimgibson
Contributor
Contributor
Author

That did not work or at least when I tried to use it by setting the text in a text object as = $(eCHMetricMedian) I get nothing.

swuehl
MVP
MVP

If you want the replacement to happen when the script executes, you can use a dollar sign expansion:

Set vCHMetricToUse=A-AD;

Set eCHMetricEncounterCNT= Count([PatientEncounterID]) - NullCount([$(vCHMetricToUse)]);

Set eCHMetricMedian=Median([$(vCHMetricToUse)]);

Set vCHMetric=Door to Admit Throughput;

If you need the replacement to happen in the front end (i.e. you want to change vCHMetricToUse also in the front end, try

Set vCHMetricToUse=A-AD;

LET eCHMetricEncounterCNT= 'Count([PatientEncounterID]) - NullCount([$' & '(vCHMetricToUse)])';

LET eCHMetricMedian='Median([' & '$(vCHMetricToUse)])';

Set vCHMetric=Door to Admit Throughput;

OR

Set vCHMetricToUse=A-AD;

LET eCHMetricEncounterCNT= Replace('Count([PatientEncounterID]) - NullCount([@(vCHMetricToUse)])','@','$');

LET eCHMetricMedian= Replace('Median([@(vCHMetricToUse)])','@','$');

Set vCHMetric=Door to Admit Throughput;

The Magic of Dollar Expansions

The Magic of Variables

Stop Dollar Sign Expansion in the script (Escape Character ??? )