Questions tagged [alasql]

Alasql - is a SQL database and data manipulation library, written in pure JavaScript and designed to work in browsers and Node.js. It provides a SQL language interface and data processing functions to data arrays. The library also provides import/export functions for CSV, TAB, JSON and other data file formats. It can use LocalStorage and IndexedDB as backend storage.

Alasql - 'à la SQL' - is a lightweight JavaScript SQL database designed to work in browser, Node.js, and Apache Cordova. It supports traditional SQL with some NoSQL functionality. Current version of Alasql can work in memory and use file, IndexedDB, and localStorage as a persistent storage.

See also

Useful links

225 questions
1
vote
1 answer

alaSQL and Google Charts

The plan is to use alaSQL to extract data from an excel spread sheet and use the resultant array as the source for a Google chart. The problem is that I can't get the results of the alaSQL call to properly populate a 2-D array that Google the charts…
ShaunK
  • 101
  • 4
0
votes
1 answer

Why doesn't my Alasql UDF work with grouped data?

Say I have some cats: interface Cat { name: string age: number color: string } I want to sum the ages of cats of each color. This works as expected in (Ala)SQL: const sql = ` SELECT name, sum(age) FROM ? GROUP BY color ` alasql(sql,…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
0
votes
4 answers

How to only return a calculated value to results after a SQL join?

I have two tables and I only want a start date from a query on table2 to be added to the values on table1. The start date is deduced with a GROUP BY statement, for example: Table 1 ID Summary End 1 Heading 01/01/2023 2 Heading…
0
votes
0 answers

Why doesn't the for loop in my recursive function iterate twice?

I'm trying to run the below code. From the output I've observed, it never runs a second loop, but there's supposed to be a second loop at 'propa'. Code on JS fiddle: https://jsfiddle.net/g0z87pvk/ const alasql = require('alasql'); function…
hungryWolf
  • 391
  • 1
  • 3
  • 15
0
votes
1 answer

alasql JSON Query - Limitation or User error? Unable to query an item which is inside an array but when not present on first position

I just found alasql and its awesome! However I am not sure if this is a know limitation or an issue with my query but for some reason, I can't find value "algb2b-gb" in below JSON using query below. It looks like if the exact position of item in the…
Anx
  • 13
  • 4
0
votes
1 answer

How do I cast a json-like string to json object in alasql?

I have a json-like string: '{"a":"b","c":"d"}' I want to be able to query it in alasql like json, ie something like column->a. How do I do that?
Hel
  • 215
  • 2
  • 8
0
votes
0 answers

How to apply a group by for an array property

I need to group the data by sub categories, but the property is an array. I'll appreciate your help, since I'm not good with sql. Example const data = [ { title: "data 1", sub_categories:[{ id: 1, name: 'gold'},{ id: 2, name: 'water'…
Chris Michael
  • 319
  • 6
  • 18
0
votes
2 answers

Google Apps Script: Array Reference in SQL Query (Javascript/AlaSQLGS)

I cannot get my query to accept my WHERE entry: const query = "SELECT MATRIX Col1 FROM ? WHERE Col1 IN (name) "; var res = alasql(AlaSQLGS.transformQueryColsNotation(query), [values]); console.log(res.length); console.log(res[0][0][0]); res.length…
0
votes
0 answers

How do I change a column name of a table in Confluence using alasql

I have multiple pages in Confluence, each with the same table with different content. I want to collect all these tables into one table. This works. Now I want to add the name of the pages into the first column. This works. But, this column is…
Ronald
  • 1
  • 3
0
votes
1 answer

Uncaught Error: Workbook is empty in xlsx and alasql excel file export

I'm using XLSX and alasql to export json object in to excel getting workbook is empty error, how to resolve import * as alasql from 'alasql' import * as XLSX from 'xlsx' alasql.utils.isBrowserify = false alasql.utils.global.XLSX = XLSX const…
KARTHIKEYAN.A
  • 18,210
  • 6
  • 124
  • 133
0
votes
2 answers

GroupBY with alaSQL in an array of Objects

I need help to achieve this transformation of an Array of Objects. I am working with alaSQL. I need to do a GroupBY by player. I tried alasql('SELECT score FROM ? WHERE score GROUP BY player',[arrayGamePlayerObjects]) But I got this result { …
grojas123
  • 45
  • 8
0
votes
1 answer

AlaSQL & ORDER BY clause with dates

I need to get my data ordered by date and events but I'm struggling to get it working using AlaSQL query on Date objects: function testOrderBy() { var data = [{event:'A', date: new Date('2021-04-21')}, {event:'B', date: new…
Fabrice
  • 465
  • 3
  • 14
0
votes
1 answer

How to check if object is empty in Alasql

I have this example here and i'm trying to only query the empty mongodb array var data = [{ "dynamic_env": null, "mission_critical": null, "chart-version": null, "app-url": null, "mongodb": {}, "nightly_shutdown": false, …
Matan Gubkin
  • 3,019
  • 6
  • 25
  • 44
0
votes
1 answer

Test random URLs from spreadsheet using alasql

I have a large number of URLs within a xlsx file. What I'd like to do is randomly select some of these URLs, load them, then check that they return a status code of 200. So I'm using the npm alasql package to do this. At the moment, the following…
Darren Harley
  • 75
  • 1
  • 18
0
votes
1 answer

Options Page error using alasql when updating to Manifest v3

I am migrating a chrome extension to manifest v3 and keep getting an error in the options page when using alasql. I get the following error when using any SELECT query. Uncaught (in promise) EvalError: Refused to evaluate a string as JavaScript…