Fixed issue 49: Add Edit Cells / Set Null.

Added support for "null" literal.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@855 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-24 23:49:18 +00:00
parent 638eb4ac24
commit ffd6e265a9
4 changed files with 12 additions and 2 deletions

View File

@ -19,6 +19,7 @@ Fixes:
Supported by the function facetCount()
- Issue 14: "Limiting Freebase load to starred records"
We load whatever rows that are filtered through, not particularly starred rows.
- Issue 49: "Add Edit Cells / Set Null"
Features:
- Row/record sorting (Issue 32)

View File

@ -165,7 +165,7 @@ public class Parser {
next(false);
if (_token == null || _token.type != TokenType.Delimiter || !_token.text.equals("(")) {
eval = new VariableExpr(text);
eval = "null".equals(text) ? new LiteralExpr(null) : new VariableExpr(text);
} else {
Function f = ControlFunctionRegistry.getFunction(text);
Control c = ControlFunctionRegistry.getControl(text);

View File

@ -141,7 +141,12 @@ public class TextTransformOperation extends EngineDependentMassCellOperation {
ExpressionUtils.bind(bindings, row, rowIndex, _columnName, cell);
Object o = eval.evaluate(bindings);
if (o != null) {
if (o == null) {
if (oldValue != null) {
CellChange cellChange = new CellChange(rowIndex, cellIndex, cell, null);
cellChanges.add(cellChange);
}
} else {
if (o instanceof Cell) {
newCell = (Cell) o;
} else if (o instanceof WrappedCell) {

View File

@ -271,6 +271,10 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
{
label: "To Lowercase",
click: function() { self._doTextTransform("toLowercase(value)", "store-blank", false, ""); }
},
{
label: "To Blank",
click: function() { self._doTextTransform("null", "store-blank", false, ""); }
}
]
},