sharmaintl
Posts: 0
Joined: Wed Nov 21, 2012 7:10 pm

Passing local variable to backend service not working

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.

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

Passing local variable to backend service not working

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

sharmaintl
Posts: 0
Joined: Wed Nov 21, 2012 7:10 pm

Passing local variable to backend service not working

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.

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

Passing local variable to backend service not working

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

sharmaintl
Posts: 0
Joined: Wed Nov 21, 2012 7:10 pm

Passing local variable to backend service not working

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!

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

Passing local variable to backend service not working

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

sharmaintl
Posts: 0
Joined: Wed Nov 21, 2012 7:10 pm

Passing local variable to backend service not working

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

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

Passing local variable to backend service not working

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

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

Passing local variable to backend service not working

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.

Return to “Issues”