Page 1 of 2

Passing local variable to backend service not working

Posted: Sun Jan 06, 2013 4:34 pm
by sharmaintl

Hello,

Here is what I am trying to do. I have a collection in the Tiggzi backend service. It has multiple columns, one of which is called 'Player Name'. The first query I run puts names of Players on a page in my App., in a list. This works fine. What I am trying to do next is when one clicks on of these these names, transition to another page with more details of the Player clicked on. This is not working.

Here is how I am doing it. On the Click on the list element, I am doing two things:
1st - setting a Local Variable to list element - Text
2nd - transition to new page

On the new page, I am calling the DB query again on Load. I am passing the Local Variable to the 'where' parameter of the Query by mapping it to the 'where' query and adding JavaSript:

return '{"Player Name":"'+value+'"}';

I am getting no data on the page. What am I doing wrong?

Thanks.


Passing local variable to backend service not working

Posted: Sun Jan 06, 2013 5:38 pm
by maxkatz

The easiest way to debug this is to view the request in Chrome Dev. Tools (or Firebug). The Network tab will show you the exact data that's being sent to the server. The query that you return is not correct. This shows a valid query: http://docs.tiggzi.com/tutorials/buil...


Passing local variable to backend service not working

Posted: Mon Jan 07, 2013 6:35 am
by sharmaintl

Max, how is the query not correct? Do you mean my JS added is wrong? I cut and pasted it from the same link you pointed me to. I just replaced 'Maker' with 'Player Name'. Kept the rest the same.

The Chrome Dev Tools shows this:
'Request URL:http**://api.tiggzi.com/rest/1/db/collections/redskinsDB?where=%7B%22Player+Name%22%3A%22%22%7D'

(I added the ** after http to make the whole URL appear as text)

So, nothing is being grabbed from the Stored Variable.


Passing local variable to backend service not working

Posted: Mon Jan 07, 2013 5:12 pm
by maxkatz

Sorry, my bad. The query is correct. Check in the Resources tab if the local storage variable was set.


Passing local variable to backend service not working

Posted: Tue Jan 08, 2013 2:29 am
by sharmaintl

Big problem it seems. I see local variables in the Resources tab that I had in my app but deleted. The actual variable that I am setting is not even on the list. Please help!


Passing local variable to backend service not working

Posted: Tue Jan 08, 2013 4:28 am
by maxkatz

How do and where do you set the local storage variable?


Passing local variable to backend service not working

Posted: Tue Jan 08, 2013 4:35 am
by sharmaintl

I am setting it as an event. List Item - Click - Set local variable and mapping the local variable to the 'Text' of the List Item clicked on


Passing local variable to backend service not working

Posted: Tue Jan 08, 2013 4:40 am
by maxkatz

Can you post a screen shot of the UI and the event being created? Which value do you use to set the variable?


Passing local variable to backend service not working

Posted: Tue Jan 08, 2013 4:41 am
by sharmaintl

Attached. Image


Passing local variable to backend service not working

Posted: Tue Jan 08, 2013 5:00 am
by maxkatz

Use the approach as in this tutorial: http://docs.tiggzi.com/tutorials/buil...

Insert one label into the list, it will be used for display but you can also read its value the set a local storage variable.