Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

about ListGrid formula

$
0
0
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:

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);

4. How should I do? Thanks.

Viewing all articles
Browse latest Browse all 4756

Trending Articles