Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    17:59:10.177:TMR0:WARN:FormulaBuilder:Error attempting to convert formula text 'M+' t

    SmartClient Version: v8.3p_2013-06-16/PowerEdition Deployment (built 2013-06-16)

    In a particular ListGrid I've added a formula column with the expression M+N. The formula builder declares it a valid formula and both fields M and N are type="integer" but the result of the formula is a concatenation of the two numbers as strings. "00" in the case where M=0 and N=0. When M=1 and N=0 the result is "10".

    This does not happen on other grids. The developer console shows this warning.

    17:59:10.177:TMR0:WARN:FormulaBuilder:Error attempting to convert formula text 'M+' to a function:syntax error

    In this case, the datasource that backs the grid is created dynamically in client side code by 'cloning' fields from other datasources. The technique I'm using to clone the fields is new DataSourceField(otherDS.getField("fieldName").getJsObj()). Is that the correct way to clone the field? I need to take all of the fields attributes from the other datasource when creating the new field.
    Last edited by jay.l.fisher; 19 Jun 2013, 15:12. Reason: clarification

    #2
    We haven't seen this problem, but your description of "cloning" the fields isn't really safe. What you're doing is setting up two Java DataSource fields which point to the same underlying JS object. This means if the field is modified in one of the dataSources, the change will also be applied to the other one, leading to potential strangeness within your app.

    The safest way to create a copy of the field is to go through the properties you actually want to pick up and apply them directly to a new field.
    Alternatively you could come up with a different pattern - for example - if you're just adding fields, you could have a superclass dataSource with the standard set of fields use inheritsFrom to pick them up.
    Or you could create a DataSource subclass which, as part of its constructor, builds its own standard field set in addition to any fields the developer passes in.

    Comment

    Working...
    X