Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to build a parameterized variable that produces a different set analysis filter for a bunch of straight table expressions.
This is the literal expression I start with:
=ONLY({<Indicator={'Maximum Vacuum (Postop)'}>} Value)
I use $ substitution:
=ONLY({$(vtest(1))} Value)
but get nulls in the chart.
Definition of vtest:
<Indicator={' & chr(39) & SubField('$(eIndicatorSelectionsArray)','|',$1) & chr(39) & '}>
Trying to troubleshoot, I put quotes around the expression:
='ONLY({$(vtest(1))} Value)'
then the result in the chart matches the original expression text: ONLY({<Indicator={'Maximum Vacuum (Postop)'}>} Value)
so the SubField function and $Expansion are working fine.
Can anyone see what I'm missing?
Thx
-Kevin
A good technique to debug these rather comlplex substitutions is to simulate them by hand.
For example
=ONLY({$(vtest(1))} Value)
with vtest containing
<Indicator={' & chr(39) & SubField('$(eIndicatorSelectionsArray)','|',$1) & chr(39) & '}>
and nothing else, first expands into:
=ONLY({<Indicator={' & chr(39) & SubField('Some|string|that|doesnt|really|matter','|',1) & chr(39) & '}>} Value)
which isn't really a regular set analysis spec. The quotes turn it into a mess. Marcus has a good suggestion, but I think that this vtest content may work even better (no double quote pairs):
<Indicator={"$(=SubField('$(eIndicatorSelectionsArray)','|',$1))"}>
Best,
Peter
PS Sorry about the font size, but I couldn't get the examples to stand out and stay on the same line at the same time...
Somehow it's an expansion issue I guess. May be missing quotes in variable declaration or improper '='. Could you share your sample qvw?
Try it with:
<Indicator={"=chr(39) & SubField('$(eIndicatorSelectionsArray)','|',$1) & chr(39)"}>
If you used your expression within a table-chart and left the label for the expression blank you could see how qv interpreted the expression.
- Marcus
Hi,
You can create a parameterized variable for the expression you have written and use it in set analysis.
Hope this may be useful for you, observe the variables in the variable overview window.
Thanks
Kiran kumar
A good technique to debug these rather comlplex substitutions is to simulate them by hand.
For example
=ONLY({$(vtest(1))} Value)
with vtest containing
<Indicator={' & chr(39) & SubField('$(eIndicatorSelectionsArray)','|',$1) & chr(39) & '}>
and nothing else, first expands into:
=ONLY({<Indicator={' & chr(39) & SubField('Some|string|that|doesnt|really|matter','|',1) & chr(39) & '}>} Value)
which isn't really a regular set analysis spec. The quotes turn it into a mess. Marcus has a good suggestion, but I think that this vtest content may work even better (no double quote pairs):
<Indicator={"$(=SubField('$(eIndicatorSelectionsArray)','|',$1))"}>
Best,
Peter
PS Sorry about the font size, but I couldn't get the examples to stand out and stay on the same line at the same time...
Kiran,
I already have a parameterized variable defined: vtest(i)
The problem seems to be a scope\evaluation issue.
Peter,
The problem seems to be a scope\evaluation order issue. To get the variable to reevaluate the parameter each time it's called, I can't have an = starting the variable definition. But I do still need to evaluate the SubField function somewhere, which means the evaluation command has to be at least a level above i.e. exactly like your last suggestion, a $(=expression) surrounding a $(substitution).
Thank you!
Correct analysis. you're on to it.
Good luck, and enjoy QlikView and the Qlik community.
Peter