hawkfish / olapscript

An OLAP engine for Google App Script
MIT License
3 stars 1 forks source link

syntax, still #88

Closed presentoccupant closed 2 years ago

presentoccupant commented 2 years ago

I took your first example from #87 and changed 3 things:

// Read the data for sheet1 const sales = Table.fromSheet(leftSheet) // Keep only the name column .select([{expr: name}]);

// Read the data from sheet2 const customers = Table.fromSheet(rightSheet) // keep only the "name" column renamed to "name2" .select([{expr: name, as: "name2"}]);

// Build the list of unique missing names from sales const missing = sales // A left join keeps any unmatched rows from the left (probe, sales) side // by filling in nulls for the right (build, customers) side columns .equiJoin(customers, {probe: name, build: name2}, {type: 'left'}) // We can then filter it down to the name2 values that are null .where(new FuncExpr(Expr.isnull, [name2])) // And remove the duplicates .groupBy(name) .toSheet(target) ;

I get the following error when I try to run it:
ReferenceError: Unknown column: Email. Did you mean "email2"?
evaluate    @ olapscript.gs:209
(anonymous) @ olapscript.gs:1373
Table.select    @ olapscript.gs:1371
testAnother @ Code.gs:198

These just confound me.  What could I possibly have changed that would produce such an error?  Line 198 is

.select([{expr: name, as: "name2"}]);

hawkfish commented 2 years ago

You want

.select([{expr: name, as: name2}]);

(no quotes). You set the as member to a string instead of the RefExpr! Hopefully when the parser is up this sort of problem will go away...