alasql


AlaSQL can you use DISTINCT with SEARCH


Say I have an array that looks like this:
var data = [{
"categories": [{
"categoryName": "‌belt‌",
"categoryValue": "‌white‌"
}, {"categoryName": "‌level‌", "categoryValue": "‌Beginner‌"}, {
"categoryName": "‌type‌",
"categoryValue": "‌technique‌"
}], "id": 1, "skillName": "‌Beginner 1‌", "skips": 0, "weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌white‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Beginner‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 2,
"skillName": "‌Beginner 2‌",
"skips": 0,
"weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌white‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Beginner‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 3,
"skillName": "‌Beginner 3‌",
"skips": 0,
"weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌white‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Beginner‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 4,
"skillName": "‌Beginner 4‌",
"skips": 0,
"weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌white‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Beginner‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 5,
"skillName": "‌Beginner 5‌",
"skips": 0,
"weight": 1
},
...
{
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌orange‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Intermediate‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 13,
"skillName": "‌Intermediate 3‌",
"skips": 0,
"weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌orange‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Intermediate‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 14,
"skillName": "‌Intermediate 4‌",
"skips": 0,
"weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌orange‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Intermediate‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 15,
"skillName": "‌Intermediate 5‌",
"skips": 0,
"weight": 1
}, {
"categories": [{"categoryName": "‌belt‌", "categoryValue": "‌purple‌"}, {
"categoryName": "‌level‌",
"categoryValue": "‌Intermediate‌"
}, {"categoryName": "‌type‌", "categoryValue": "‌technique‌"}],
"id": 16,
"skillName": "‌Intermediate 6‌",
"skips": 0,
"weight": 1
}
...
]
Let's say that we want to query this, something like:
alasql('SEARCH /categories/categoryValue WHERE(categoryName="belt") FROM ?', [data]);
This is probably going to give you something like:
['white', 'white', 'white',...'orange', 'orange',...'purple'...]
What I'd like is:
['white', 'orange', 'purple']
Is there any way to do this on the query side, or do I need to just filter it for unique values after it returns?
According to this test and this test (line 85), the syntax should be:
alasql('SEARCH DISTINCT(/categories/ WHERE (categoryName="belt") categoryValue) FROM ?', [data]);

Related Links

how to change font as bold in excel file using alasql?
AlaSQL can you use DISTINCT with SEARCH
Can one use CSV as an in-memory database with alasql?
Export the data to excel & formatting that as requirements
determining what array elements were removed
return alasql informational results
INSERT/UPDATE existing object?
How to insert data in google spreadsheet with tabletop?
How can I export to excel using alaql to multiple sheets AND have different display options for each sheet
AlaSQL saved database location
running two queries and then joining the results alasql promise notation
parent and child key in alasql rollup functions
Alasql select in arrary of array with uknown index
Alasql Best Practices
Alasql - Having columns with sub-columns
AlaSQL: Getting where opperands

Categories

HOME
classification
redux
mobile
window.open
itext7
xss
foreach
liquidsoap
webpack-dev-server
jpql
core-data
mamp
desktop-application
jinja2
reportlab
single-page-application
openoffice-basic
xna
datazen-server
pumping-lemma
uipath
poisson
rancher
stack-trace
key-bindings
visual-studio-debugging
traitsui
zimbra
headphones
azure-vm-scale-set
sdl-2
delphi-xe
file-descriptor
autodesk-data-management
encoder
runner
confluent
noise
playframework-1.x
chain
disassembly
addressbook
alarmmanager
x12
hoare-logic
qtruby
gdi
boost-bind
ideavim
jersey-test-framework
yfiles
dynamics-nav
gtkwave
gnu-sort
sdkman
gulp-cdnizer
pushwoosh
nmock
vectordrawable
genome
screen-lock
ultraedit
google-experiments
unityvs
diffmerge
growl
tigase
livescript
behance-api
ant-contrib
hotlinking
enquire.js
xps
windows-phone-store
mdp
xml-validation
grunt-contrib-imagemin
infomaker
kohana-orm
typography
dynamic-expresso
panelgrid
mosix
auctex
database-restore
gpl
metapost
custom-cursor
hypertable
diazo
parsec
joomla1.7
nsundomanager
cgaffinetransform
netduino
table-valued-parameters
web-search
newspeak
hp-trim
jgrowl
httpbrowsercapabilities
ironpython-studio

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile