Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am loading the following INLINE table
LOAD * INLINE [
Metric, ShortDSC, LongDSC, SortOrder, MedianCalc
A-AD, Door to Admit, median of Door to Admit, 1, Median('A-AD')
A-OF, Door to On-Floor, median of On-floor, 3, Median('A-OF')
A-RD, Door to Ready for Discharge, median door to discharge, 2, Median('A-RD')
];
This loads without errors but when I try to load the Expression into the Definition box of a straight table as $(MedianCalc) I do not get any results. Normally to use the expression I have to use Median([A-AD]) however the INLINE does not like the [] so I replaced them with '' and it loads.
Any ideas on what I am doing wrong?
Hi Jim,
Try this expression..
$(=concat('if(Metric=' & chr(39) & Metric & chr(39) & ',Median({1}[' & Metric & '])', ',') & concat(right(Metric&')',1)))
You can replace the square brackets on the inline using double quotes. Then you can use square brackets in the inline.
LOAD * Inline
"
...
";
Are you trying to reference the field in the $ expansion? Do you want to evaluate it as an expression? is A-AD a field in your model?
I am not sure what you mean by the "definition box".
Also note that in a straight table this will only work if you don't use any of the other INLINE table field as a dimension. $-sign substitution will be performed only once for the entire table, not row-by-row.
You can use the Metric field as a list box with Always-One-Selected enabled, to select a single expression to be displayed.
Hi,
May be try =$(=MedianCalc)
IMHO that won't work with MedianCalc being a field name. Because as a first step the expression will expand to:
=$(Median([A-AD])) // doesn't work as there is no variable with that name
if a single Metric is active, or to
=$() // probably generates an error
if multiple Metrics are selected.
Jim will have to use an intermediate variable that first upon evaluation stores the value of MedianCalc and only then does the $-sign substitution.
In Variable Overview, define a variable called vMetricExpression and assign the following as value:
=MedianCalc
Then in the expression field where the dynamic expression should provide results, put:
=$(vMetricExpression)
Best,
Peter
Thank you Peter ..
Peter,
I tried this but I still do not get any results. See the attached PDF. The third column in the straight table does not give any results.
Any ideas?
Can you share the Sample Qvw?
if you say that the expression works ok with brackets, then just replace where you add the brackets to the field, you can do this with a preceding load
load
Metric,
ShortDSC,
LongDSC,
SortOrder,
'Median(['&MedianCalc&'])' as MedianCalc;
LOAD * INLINE [
Metric, ShortDSC, LongDSC, SortOrder, MedianCalc
A-AD, Door to Admit, median of Door to Admit, 1, A-AD
A-OF, Door to On-Floor, median of On-floor, 3, A-OF
A-RD, Door to Ready for Discharge, median door to discharge, 2, A-RD
];