-
Notifications
You must be signed in to change notification settings - Fork 664
Modifiers
Mathias Rangel Wulff edited this page Jun 12, 2015
·
4 revisions
Return Value Modifiers use for modification of alasql() function output from array of objects to anothe JavaScript data structure, like array of arrays.
Returns array of objects:
alasql('SELECT * FROM one');
=> [{a:1,b:10},{a:2,b:20}]
Returns first value of first row:
// Return number of all lines in README.md
alasql('SELECT VALUE COUNT(*) FROM TXT(‘README.md’)');
=> 745
Returns first column from all rows:
alasql('SELECT COLUMN a FROM ?',[data]);
=> [1,2]
Returns values of all columns of first row:
alasql('SELECT ROW a FROM ?',[data]);
[1,10]
Returns array of arrays:
alasql('SELECT MATRIX * FROM ?',[data]);
=> [[1,10],[2,20]]
Create object by key, value
alasql('SELECT INDEX a,b FROM ?', [[{a:1,b:10},{a:2,b:20}]])
=> {1:{b:10}, 2:{b:20}}
Create text by merging values of arry and joining with '\n'.
"This is a line\nand another line"
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo