This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using DSS to evaluate non-integer values



Hi,

The only way read variables and expressions using DSS it to use Expression.evaluate(sExpression).

The limitation of using this API is that it returns Long value, it can't be float, can't be double can't be any other type (struct for example).

Is there any other API which can return the expression as different type other than Long?

  • Hello,

    Yousf Badr said:
    The only way read variables and expressions using DSS it to use Expression.evaluate(sExpression).

    Expression.evaluate is really to execute GEL functions. I would use memory.readData or memory.readWord to read variables. Those APIs can also return an array of data.

    You can always convert the value from a long also. javascript has some functions from this (toString(), toFixed(), etc)

    Thanks

    ki

  • I already use this trick to read value of variables, but can't do it to expressions:

    For example Expression.evaluate('100.0 * g_info_obj.m_float_value1 / g_info_obj.m_float_value2'). If the passed expression is hard coded, I would read each variable and do the evaluation in javascript, or put the result in another variable and read its memory.

    But currently, the expressions are passed from user.

  • Yousf Badr said:
    . I would read each variable and do the evaluation in javascript, or put the result in another variable and read its memory.

    This is probably the best way to do it. The expression.evaluate routine was mainly provided to have access to GEL, GEL is quite limited in its functionality in regard to types.