Query with local storage

This forum contains topics that were moved from Get Satisfaction
Joao Marcos Barbosa Oliveira
Posts: 0
Joined: Sat Jan 04, 2014 2:30 pm

Query with local storage

Post 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)

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Query with local storage

Post by Igor »

Joao Marcos Barbosa Oliveira
Posts: 0
Joined: Sat Jan 04, 2014 2:30 pm

Query with local storage

Post 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?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Query with local storage

Post 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...

Joao Marcos Barbosa Oliveira
Posts: 0
Joined: Sat Jan 04, 2014 2:30 pm

Query with local storage

Post by Joao Marcos Barbosa Oliveira »

Thanks!

Caio
Posts: 0
Joined: Thu Jan 30, 2014 8:36 pm

Query with local storage

Post 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.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Query with local storage

Post by Igor »

Oliver Fisk
Posts: 0
Joined: Wed Jul 09, 2014 10:02 pm

Query with local storage

Post 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

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Query with local storage

Post by Serhii Kulibaba »

Hello Oliver,

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

Oliver Fisk
Posts: 0
Joined: Wed Jul 09, 2014 10:02 pm

Query with local storage

Post 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

Post Reply