Page 2 of 2

using a "where" parameter to search in a local storage array

Posted: Sat May 16, 2015 7:08 pm
by LuisMa Suárez Gutiérrez

Hi, Evgene.

yes, please.I still need assistance.
I'm lost. and since I feel this should be easy, I'm frustrated.
I created the generic service and ran the SQL code to extract data from the SQL database, this dumped all the DB entries on to the console, but i couldn't map to my list.

I remembered a similar issue that Yurii Orishchuk helped with,albeit with an online DB. where i needed to use console dump and import parameters. so, i decided I decided to use echo mode
.
Iterate mapping over a grid, 3 per row

this allowed me to map to list and i was really happy, but then i realized it wasn't doing anything, it just repeated the data on logged console without doing and SQL lookup.

all i want to do is find people from a DB on storage, right now i'm using an excel spreadsheet to lookup names.

right now, I am haflway there, please tell me what I am missing

at first it almost works, data is recovered from localDB and data goes to console

http://prntscr.com/75xx3z

but notice it doesn't map to list.

then i copy text from console it paste it into echo field
http://prntscr.com/75xyf7

suddenly it maps, but it is not looking up data. just repeating the text in echo mode.

What I need is to filter list as I type. So I need the service to take in searchbar.text as a input parameter. like i said.

should i be using a generic security context that yuri taught me?


using a "where" parameter to search in a local storage array

Posted: Wed May 20, 2015 5:20 pm
by LuisMa Suárez Gutiérrez

ok , so all i did was remove the stringify(JSON) part form the last line if the JS implementation.
since i needed a complete JSON object to extract the individual columns from the SQL search results.

i changed this
settings.success(JSON.stringify(ourFinalArray));
to this.
settings.success(ourFinalArray);

it worked . now i an run WHERE statements and LIKE statements , but only if i hardcode them.

now i want to use the searchbar.
ive tried this

tx.executeSql('SELECT * FROM "Tables" WHERE nombre LIKE " '+localStorage.getItem("searchtext")+' "' , [], function(tx, results)......
with i prior mapping to localstorage variable on service BEFORECALL

and ive tried

tx.executeSql('SELECT * FROM "Tables" WHERE nombre LIKE " '+Apperyio('mobilesearchbar_21').text+' "' , [], function(tx, results)......

in one option I just get a a null search result and option 2 throws a "Appeyio is undefined " error


using a "where" parameter to search in a local storage array

Posted: Thu May 21, 2015 1:56 am
by LuisMa Suárez Gutiérrez

update, i forgot the %% signs to make it search anywhere the text appears .

it works now. i wasnt able to use the mobilesearchbar.text route, i had to map the searchbar text to a local storage variable and THEN use localStorage.getItem.('variable')