on 2021 May 21 7:31 PM
Hi,
I've a variable prompt for Rate_Type based on user selection I'm filtering my measures to show appropriate value.
I am able to capture the value from user prompt selection, but when I'm comparing it, i am getting conversion error, off course due to Array to String.
I tried using "toString" method as mentioned in DeveloperPdf, I don't get any errors in code after that, but it dosent execute { condition }
var rate_type = Crosstab_Global.getDataSource().getVariableValues("BPC_AMNT_TYPE");
for (var i = 1; i < rate_type.length; i++) {
if (i.toString() === "AT_2")
{
// apply filter
} }
Your response is much appreciated, thank you
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Hi mohd.fahad,
indeed extracting the value you need from the variable value is a little tricky.
Try this:
switch (rate_type.type) {
case VariableValueType.Single:
var singleValue = cast(Type.SingleVariableValue, rate_type);
console.log(singleValue.value); // you can access the 'value' property now
// apply filter with singleValue
break;
case VariableValueType.Multiple:
var multiValue = cast(Type.MultipleVariableValue, rate_type);
console.log(multiValue.values); // you can access the 'values' property now
// apply filter with multiValue
break;
default:
break;
}
Hope this helps you out,
Cheers,
Chia-Yu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got it working, I checked against reference guide, I forgot to mark Index
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.