-
Notifications
You must be signed in to change notification settings - Fork 0
Variables
Variables available in expressions
| variable name | meaning |
|---|---|
| value | the value of the cell in the base column of the current row; can be null |
| row | the current row; an object with more fields, with details below |
| cells | the cells of the current row, with fields that correspond to the column names; more details below |
| cell | the cell in the base column of the current row; an object with more fields, with details below |
| recon | the recon object of a cell returned from a reconciliation service or provider; an object with more fields, with details below |
| record | one or more rows grouped together to form a record; an object with more fields, with details below |
A row object has a few fields, which can be accessed with a dot operator or with square brackets: row.index, row["index"], much like in Javascript.
| field name | meaning |
|---|---|
| row.index | zero-based index of the current row |
| row.cells | the cells of the row, same as the "cells" variable above |
| row.columnNames | the column names of the row (i.e. the column names in the project) |
| row.starred | boolean, indicating if the row is starred |
| row.flagged | boolean, indicating if the row is flagged |
| row.record | the Record object containing the current row, same as the record variable above |
The cells object, which can also be accessed as row.cells, has fields that correspond to the data column names. For example, cells.Foo returns a cell object representing the cell in the column named Foo of the current row. If the column name has spaces, use the square bracket method, e.g., cells["Postal Code"].
When you need to get the value of the cells variable itself, you need .value at the end, e.g.,
cells["column name"].value
When you need to set or mass edit the values of the columns cells, then you can simply use a GREL expression within quotes, such as just
"San Francisco Bay"
Alternatively, you can use a Facet which has a built-in edit link next to each value in the Facet panel that allows you to replace large quantities of cell values in one shot.
A cell object has two fields
| field name | meaning |
|---|---|
| cell.value | the value in the cell, which can be null, a string, a number, a boolean, or an error |
| cell.recon | an object encapsulating the reconciliation results for that cell |
A recon object has a few fields
| field name | meaning | deeper fields |
|---|---|---|
| recon.judgment | a string that is one of: "matched", "new", "none" | |
| recon.matched | a boolean, true if judgment is "matched" | |
| recon.match | null, or the recon candidate that has been matched against this cell | .id .name .type |
| recon.best | null, or the best recon candidate | .id .name .type .score |
| recon.features | an object encapsulating reconciliation features | .typeMatch .nameMatch .nameLevenshtein .nameWordDistance |
| recon.candidates | an object encapsulating the default 3 candidates | .id .name .type .score |
recon.candidates array can be accessed with something like:
forEach(cell.recon.candidates,v,v.id).join(",")A recon candidate object has a few deeper fields: id, name, type, and score, whose meanings are obvious. type is an array of type IDs. So, the id of the best candidate can be accessed as any one of
- recon.best.id
- cell.recon.best.id
- row.cells[" (current column's name here) "].recon.best.id
You get the idea.
A features object has the following fields:
- typeMatch, nameMatch: booleans, indicating whether the best candidate matches the intended reconciliation type and whether the best candidate's name matches the cell's text exactly
- nameLevenshtein, nameWordDistance: numbers computed by comparing the best candidate's name with the cell's text; larger numbers mean bigger difference
A record object encapsulates one or more rows that are grouped together. For example, the following data set has 2 records, the first grouping 2 rows and the second grouping 3 rows:
| row | author | book | date |
|---|---|---|---|
| 1. | Neal Stephenson | Anathem | 2009 |
| 2. | Snow Crash | 2000 | |
| 3. | J.K. Rowling | Harry Potter and the Half-Blood Prince | 2006 |
| 4. | Harry Potter and the Order of the Phoenix (Book 5) | 2005 | |
| 5. | Harry Potter and the Chamber of Secrets (Book 2) | 2000 |
A record object has a few fields, which can be accessed with a dot operator or with square brackets: record.index, record["index"], much like in Javascript.
| field name | meaning | example |
|---|---|---|
| record.index | zero-based index of the current record | evaluating row.record.index on row 2 returns 0 |
| record.cells | the cells of the row | evaluating row.record.cells.book.value on row 2 returns [ "Anathem", "Snow Crash" ] |
| record.fromRowIndex | zero based index of the first row in the record | evaluating row.record.fromRowIndex on row 2 returns 0 |
| record.toRowIndex | index (not zero based) of the last row in the record | evaluating row.record.toRowIndex on row 2 returns 2 |