Page 1 of 1

Get service: Setting the request parameter and corresponding dynamic value

Posted: Mon Oct 15, 2012 3:31 pm
by Melvin Tan Gim Huat

Hi, I am facing a syntax issue with setting the request parameter and its corresponding value for a Get service.

On Screen 1, I have the following code to store the value of a user-input string.
localStorage.setItem(giftListKey, mattress);

On Screen 2, I want to use this value to query for data in the Tiggzi database via Get service.

  • What request parameter should I use while setting up the Get service? "where" or "query"?

  • How can I make the value dynamic? I want to pull it via localStorage.getItem(giftListKey) but have not been able to make it work.

    Appreciate your advice.
    Thank you.


Get service: Setting the request parameter and corresponding dynamic value

Posted: Mon Oct 15, 2012 3:49 pm
by maxkatz

The parameter name should be 'where'. What is the column name in which you are searching for values in?

As for making it dynamic, you can map the local storage variable to 'where' parameter and then create the query in JavaScript.

As you use local storage API directly, you would need to create a variable in the same name in mapping (right-hand side), http://help.gotiggr.com/documentation...


Get service: Setting the request parameter and corresponding dynamic value

Posted: Mon Oct 15, 2012 4:07 pm
by Melvin Tan Gim Huat

Thanks Max.

The column name is "Gift Name".
The key for the localStorage is "giftListKey".

I suppose the query in JavaScript is: return '{"Gift Name":"'+value+'"}'; , correct?

I have created a variable in mapping (on the right-hand side). When you say that it should be the same name, do you mean that this variable should be called "giftListKey" in this case?

I tried the above but it still does not pull the required data from the Tiggzi database.

Appreciate your advice.


Get service: Setting the request parameter and corresponding dynamic value

Posted: Tue Oct 16, 2012 12:30 am
by maxkatz

Let me know if this helps: http://blog.tiggzi.com/2012/10/buildi...


Get service: Setting the request parameter and corresponding dynamic value

Posted: Tue Oct 16, 2012 2:19 pm
by Melvin Tan Gim Huat

Thanks Max.

I figured out the problem. It was indeed a syntax issue as I had suspected. In Screen 1, I had declared the key as a variable, i.e.

var giftListKey;
localStorage.setItem(giftListKey, mattress);

When I changed the key to a string instead, the Get REST service in Screen 2 worked right away.