Page 1 of 2

Query with local storage

Posted: Sat Jan 04, 2014 2:30 pm
by Joao Marcos Barbosa Oliveira

How I do a query with a local storage?
Where I have to put a JS?
I want to do something like it:
Select name from places where idusuario=id_usuario(<-local storage)


Query with local storage

Posted: Sat Jan 04, 2014 2:55 pm
by Igor

Query with local storage

Posted: Sat Jan 04, 2014 3:18 pm
by Joao Marcos Barbosa Oliveira

Hello, thx for help, but i still confused

I'm trying everything. Can you show a step by step way?

I have created a Places_places_query_service. On the request parameters i have a where parameter with empty default value, I have to change this parameter?


Query with local storage

Posted: Sat Jan 04, 2014 3:42 pm
by Igor

if you use empty value in the where clause it will return all record from DB.
For example if you want to find the object with some ID you should do next:

  1. put object value to localStorage variable;

  2. map localStorage variable to where parameter;

  3. add JS code to where parameter:
    pre
    return '{"_id": "' + value + '"}';
    /pre
    _id - column name from your DB collection

    This tutorial will help you to find all information that you need.
    http://docs.appery.io/tutorials/build...


Query with local storage

Posted: Sun Jan 05, 2014 4:26 pm
by Joao Marcos Barbosa Oliveira

Thanks!


Query with local storage

Posted: Mon Feb 03, 2014 9:22 pm
by Caio

Hi Igor,

I'm having a problem doing a query with local storage. I've used the same code (adapting to my column name) but it is returning "undefined".

I've checked the local variable pointing the response to a Label on the UI and it's being saved correctly.

But the query doesn't work.


Query with local storage

Posted: Mon Feb 03, 2014 10:40 pm
by Igor

Query with local storage

Posted: Fri Oct 16, 2015 10:24 am
by Oliver Fisk

How is this done if I want to use multiple values in an "and" query?

return '{"_id": "' + value + '"}';

Can only be used for one locale variable.

What if I want two or more?

Oli


Query with local storage

Posted: Sat Oct 17, 2015 10:23 am
by Serhii Kulibaba

Hello Oliver,

Please look at this documentation:
https://devcenter.appery.io/documenta...


Query with local storage

Posted: Mon Oct 19, 2015 3:09 pm
by Oliver Fisk

Hi Sergiy,
Thanks for that but I could see lots of information about explicitly stated comparisons but nothing about using local storage.
Likewise all the queris are written as though directly querying the database in code whereas the +value+ part is used in the app builder with the visual mapping.
Oliver