on 2020 Mar 30 8:23 AM
Hi everybody,
In SAP Analytics Cloud Application Designer, I would like to get a variable value to a text field. I know that through getVariables(), I can print the variables themselves, but I'm interested in the variable values, for instance a date.
Does anyone have experience with how this can be done?
Thanks in advance.
Mathias
Request clarification before answering.
This code worked for me (I found it elsewhere, so don't fully understand it - but it works)
var variable = tbl_main.getDataSource().getVariables()[0];
var value = tbl_main.getDataSource().getVariableValues(variable)[0];
switch (value.type) {
case VariableValueType.Single:
var singleValue = cast(Type.SingleVariableValue, value);
console.log(singleValue.value);
txt_box.applyText(singleValue.value);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can try this.
Create a chart and assign only one dimension = variable (it has to show only one selected value from the BW )
variable should come from the BW as a dimension.
var res = Chart_1.getDataSource().getMembers(" variable");
text.applytext(res);
Thanks,
Saurabh S.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathias,
do you already have a solution for this as I am also struggeling with this problem. I also would like to display the values from the variables of an BW Query to show the selected dates.
foekenm : In the Handbook there is no description concerning this. Only for setting variables in scripting or removing and copying variables values between two different datasources. 😞
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathias,
Did you already check in the Analytics Designer Handbook?
https://www.sapanalytics.cloud/analytics-designer-handbook/
Kind regards,
Martijn van Foeken | Interdobs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
long time since opening, but i did this to show the variable selection in a Textfield.
Depending on the variable type.
I found this script somewhere and adaopt it to my requirements - it works well.
************************************************************************************************************
g_COFilter = TBL_COOBJ_900.getDataSource().getVariableValues("<<BW Variable>>")[0];
var l_txt = "";
var i = 0;
switch (g_COFilter.type) {
case VariableValueType.Single:
var singleValue = cast(Type.SingleVariableValue, g_COFilter);
console.log(singleValue.value); // can access the 'value' property now
TXT_COFILTER.applyText(singleValue.value);
break;
case VariableValueType.Multiple:
var multiValue = cast(Type.MultipleVariableValue, g_COFilter);
console.log(multiValue.values); // can access the 'values' property now
for (i = 0; i < multiValue.values.length; i++){
l_txt = l_txt + multiValue.values[i] + '\r\n';
TXT_COFILTER.applyText(l_txt);
}
break;
case VariableValueType.Range:
var rangeValue = cast(Type.RangeVariableValue, g_COFilter);
console.log(rangeValue.from); // can access the 'from' property now
console.log(rangeValue.to); // can access the 'to' property now
// further range properties: 'less', 'lessOrEqual', 'greater', 'greaterOrEqual'
TXT_COFILTER.applyText(rangeValue.from + rangeValue.to);
break;
default:
break;
}
************************************************************************************************************
Best regards
Robert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did anyone ever find a solution to this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
11 | |
8 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.