Announcement

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

    Formula Fields no Longer Stores Formula Variables

    Hi, Dear Isomorphics:

    We migrated our application from SmartGWT 13.1 Pro to 14.1 Pro (JDK 17) and found a behavior change in formula fields created from a ListGrid.

    In 13.1, when users created a numeric or text formula by selecting fields from the Formula Builder, the generated formula used variable letters such as A, B, etc., and the saved grid state included both the formula text and the `formulaVars` map.

    For example, if the selected fields were PRICE and QUANTITY, the saved state looked like this:

    Code:
    {
      name:"MyField1",
      userFormula:{
        text:"A*B",
        formulaVars:{
          A:"PRICE",
          B:"QUANTITY"
        }
      },
      type:"float",
      canFilter:true,
      title:"MyField",
      autoFitWidth:false,
      width:104
    }

    After migrating to 14.1, the saved state now looks like this instead:

    Code:
    {
      name:"MyField1",
      userFormula:{
        text:"PRICE*QUANTITY"
      },
      type:"float",
      canEditFormula:true,
      title:"MyField",
      _hasDefaultTitle:true,
      _hasSuggestedTitle:null,
      autoFitWidth:false,
      width:137
    }
    So in 14.1:
    • the formula text is stored using the actual field names
    • formulaVars is no longer present in the serialized state

    This change is causing a compatibility issue in our application because we have logic that reads `userFormula` and `formulaVars` from the saved `ListGrid` state to perform additional actions.

    We also reviewed this Showcase entry and based on the description there, it seems the formula builder should replace fields with letter variables, but in practice we do not see that behavior in the live example either.
    Click image for larger version

Name:	FormulaBuilder_1.png
Views:	3
Size:	105.8 KB
ID:	277247

    Click image for larger version

Name:	FormulaBuilder_2.png
Views:	3
Size:	31.8 KB
ID:	277248

    Could you please confirm:

    1. whether this change is intentional,
    2. whether there is any setting to restore the previous formulaVars serialization,
    3. and what migration approach you recommend for applications relying on that structure?

    Thank you in advance for your assistance.

    #2
    We enhanced the system so that field names were used by default, since PRICE*QUANTITY is a lot more readable than A*B with a lookup table.

    We wouldn't recommend using it, but we did leave a backcompat flag FormulaBuilder.useSingleLetterKey, which can be set system-wide via just an addProperties() call in FormulaBuilder before any components are created.

    How did your code end up dependent on the keys? We're wondering if you tried to hack in server support for simple formulas, which is actually now a built-in feature.

    Comment

    Working...
    X