]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/CellValueVisitor.java
Spreadsheet Fixes
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / CellValueVisitor.java
index 652659ce0349e1b87a4fc2f472d4d7d6efd0eab0..8150b4dbadba87104e927a965c1e963970ea2fd0 100644 (file)
@@ -247,7 +247,12 @@ public class CellValueVisitor implements AstValueVisitor<Object> {
                                        if(err!=null) return err.getString();
                                        
                                        if(result instanceof String && !((String) result).isEmpty()){
-                                               return FormulaError2.VALUE.getString();
+                                               Number num = SpreadsheetGraphUtils.asValidNumber(result);
+                                               if(num == null) {
+                                                       return FormulaError2.VALUE.getString();
+                                               } else {
+                                                       result = num;
+                                               }
                                        } 
                                        else if(result instanceof Variant){
                                                Object val = ((Variant)result).getValue();
@@ -280,7 +285,12 @@ public class CellValueVisitor implements AstValueVisitor<Object> {
                                        if(err!=null) return err.getString();
                                        
                                        if(result instanceof String && !((String) result).isEmpty()){
-                                               return FormulaError2.VALUE.getString();
+                                               Number num = SpreadsheetGraphUtils.asValidNumber(result);
+                                               if(num == null) {
+                                                       return FormulaError2.VALUE.getString();
+                                               } else {
+                                                       result = num;
+                                               }
                                        } 
                                        else if(result instanceof Variant){
                                                Object val = ((Variant)result).getValue();