on 09-01-2022 2:17 PM
I'm playing arond with the BPC live API of SAC at the moment. I would like to write text + variable values to a popup. So basically this sounds very simple but does not seem to be because typecasting seems to be way more difficult in SAC script than in real programming languages where this is most of the time done automatically in modern languages.
var value1 = Table_1.getDataSource().getVariableValues('ICUPRN_0DISTR_CHAN_VERTRIEBSW1');
//Type Array
console.log(value1);
//should return one single value
var value2 = value1.pop();
console.log(value2);
//The result of pop in console log is: {value: '01', type: 'Single'} - so basically I would like to write the 01 in a text in the popupwindow
//The following command is not possible - Conversion VariableValue in String not possible - my assumption would be that it should not be difficult to cast a value '01' to string
cast(Type.string,value2);
//Write a text which is based on a static part and a variable. This meens 18 schould be dynamic and based on the variable above.
var variable = '18';
//TextArea_1 and Text_2 are belonging to a popup and should be dynamic
TextArea_1.setValue(variable);
Text_2.applyText(variable);
Popup_1.open();
This seems to be a very easy request but turns out to be not so easy. Any ideas on that?
Hi Torsten,
You can extract the value part of the variable by using the property ".value".
So basically this is how it would look:
var value2 = value1.pop();
and
String final_val = value2.value; (you can try seeing .value comes up or not by putting "." period operator and hitting Ctrl+space on the keyboard)
now you can use final_val which is a string.
Best Regards
Tharun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tharun,
I already tried this before posting. There is no ".value". When I use ctrl+space there is only type which I'm able to extract. But .value is not existing according to sac. "value is a not used property"
Best regards,
Torsten
User | Count |
---|---|
75 | |
10 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.