javascript - Populating an IndexedDB with .csv file data -
how populate indexeddb csv file? can't find simple guide anywhere online.
here example of 1 of csv files want use, they're pretty that: http://www.mediafire.com/?hlx2tpacw5dqat5
first column (row 2 down) timestamp (ms excel), column 2 (row 2 down) amount of readings, other columns temperature readings. 900 above indicates time interval in seconds between readings. final reading in row null , should disgarded( or taken) away number of readings. therefore, first reading in row taken @ time of rows timestamp minus (900 seconds multiplied (number of readings in row minus one)). in case of first value on first row value taken @ (40271.0625-(0.00024*900*(1024-1))).
what i'd have 2 columns, speak, in indexeddb. 1 time of reading (obviously these unique) , 1 temperatures. ideas? appreciated!
thanks
you can use alasql javascript sql database library. has special operators loading data txt, csv, tab, xls, , xlsx files. works indexeddb. in example need add alasql.min.js library project, create or attach (if created) indexeddb database, select columns indexeddb table csv datafile headers.
<script src='alasql.min.js'></script> <script> alasql('create indexeddb database if not exists geo;\ attach indexeddb database geo; \ use geo; \ drop table if exists country; \ create table country; \ select * country csv("country.csv",{headers:true});\ select value count(*) country',[], function(res){ document.write('number of records loaded indexeddb: ', res.pop()); }); </script>
try this sample @ alasql.org site.
Comments
Post a Comment