Table expressions do not support closures

Error: Invalid variable reference: “basin”
Note: Table expressions do not support closures. Use aq.escape(fn) to use a function as-is (including closures), or use table.params({ name: value }) to define dynamic parameters.

Hello, anyone have any idea about how to correct this?

You probably need to add aq.escape around the test; see Expressions | Arquero API Reference | arquero. for a reference.

1 Like

Thank you so much Fil. Now I found two solutions.

The first:
mergedFilter = merged.filter(d => d.Basin === basin)

The second:
mergedFilter = aq.from(merged).filter(aq.escape(d => d.Basin == basin))

Now they both work perfectly.