Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to put a value into the Gauge object

Hi Experts

I would like to use the DS_1.getData() command to retrieve data from a query
and place it into a gauge (standard object in DS). What I understand is that
the getData command retrieves a float value and the gauge object expects an integer
value. I didn’t find a float to integer conversion so I tried a work around. It
looked something like this but it did not work:

 

GAUGE_1.setValue(Convert.stringToInt(Convert.floatToString(DS_1.getData("CKXYNLFBDHH0X2U91711DX83S",
{"ZQMSITEPD":'S999'}).value)));

 

The value from the float to string conversion holds the decimals like 49,937 and this creates an error in the conversion from
string to int.

 

Does anyone have an example on how to get data from a DS into a gauge?

 

Kind regards

 

Erik

replied

HI Erik, have you tried to use the Convert object?

float can be converted to string with argument "###", this will round all numbers after colon.

eg.

var fullNumber = Convert.floatToString(55.83, "###");

var numberInt = Convert.stringToInt(fullNumber);

APPLICATION.createInfoMessage("Value " + numberInt);

fullNumber = Convert.floatToString(55.23, "###");

numberInt = Convert.stringToInt(fullNumber);

APPLICATION.createInfoMessage("Value " + numberInt);

see for many examples

Design Studio 1.3 Scripting Example to Convert String Number to Date

Regards, Karol

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question