Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

Get service: Setting the request parameter and corresponding dynamic value

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Get service: Setting the request parameter and corresponding dynamic value

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

Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

Get service: Setting the request parameter and corresponding dynamic value

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.

Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

Get service: Setting the request parameter and corresponding dynamic value

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.

Return to “Issues”