1.SmartGWT smartgwt-5.0p
2.requiement:
I need a formula fields in ListGrid, the formula is "FieldA+FieldB".
There is no problem when this value of FieldA and FieldB is not null.
But,if value of FieldA is null,I wish use 0 instead null, how should I do?
3. my code:
4. How should I do? Thanks.
2.requiement:
I need a formula fields in ListGrid, the formula is "FieldA+FieldB".
There is no problem when this value of FieldA and FieldB is not null.
But,if value of FieldA is null,I wish use 0 instead null, how should I do?
3. my code:
Code:
UserFormula userFormula = new UserFormula(); Map<String, String> map = new HashMap<String, String>(); map.put("A", "FieldA"); map.put("B", "FieldB"); userFormula.setFormulaVars(map); //userFormula.setText("A+B"); //if use this statement, if value of FieldA is null, the result is null userFormula.setText("(A==null?0:A)+B"); // no effect with A==null condition ListGridField formulaField = new ListGridField("sum", "sum"); formulaField .setUserFormula(userFormula);
Comment