Page 1 of 1

Local storage variable not mapping to request?

Posted: Wed May 08, 2013 12:12 am
by Nathanael

Hey there!

I'm trying to map a previously-set local storage variable to a JSON request, but for an unknown reason, it's not working. Attached is a picture of what I'm trying to do.

I'm assuming that, once "answer" is set (It's set on the previous screen. I've confirmed this) it should just be filling in that value on the request. However, that request is returning NULL, not the value of the local variable.

Am I missing something obvious? Image


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 12:23 am
by maxkatz

Check to make sure the value is passed, add console.log(value) to the mapping of that variable.

Check also the service request.. to see what's going on there.


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 4:29 pm
by Nathanael

By playing with default values, I've confirmed that the service is not being run at all! This doesn't make any sense, because everything appears to be set correctly.

When I access the JSON directly (http://URL.com/WHATEVER.php?a=1&b=2&c=3) the JSON executes correctly. (It also updates a MySQL table, so I am able to confirm the script is being run that way) However, when I load the screen, my database remains unchanged, indicating that the service is not being run.

Note my settings for the service in the image below. It should be working! When I test the service using the "Test" feature using the same parameter values, it works correctly. However, when I test it on the screen itself (forcing the same parameter values, avoiding local variables etc) the service does not run.

How can I troubleshoot this? The problem seems really illogical to me. It shouldn't be occurring the way it is.

Image


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 4:40 pm
by Sergey Kozyr

Hello
Are you sure that you filled all request parameters right in datasource mapping?
To debug your application in browser use Chrome Developer tools (F12 hotkey). You could see all requests to rest services in Network tab.


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 4:46 pm
by Nathanael

Yes, I'm sure! I'll attach another picture to show more of the service's settings.


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 4:47 pm
by Nathanael

Here are more pictures of the settings I'm using. As you can see, everything looks like it should. The service works when tested directly in the service's respective tab, but not when tested on the actual application. I'm using the Appery proxy, so this shouldn't be an issue.

Image


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 4:53 pm
by Sergey Kozyr

Could you send us a screenshot of Network tab in Chrome Developer tools when you start application in browser? Also "XHR" filter in Network tab must be turned on. This would help us to see all requests to rest services.


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 5:07 pm
by Nathanael

Is this what you're looking for? This is what showed up once XHR was turned on, and I navigated to the screen that is supposed to be calling the service. That is not the start page, but it is the first page I navigated to. (if that's relevant)

If I'm looking at what I think I'm looking at, it doesn't appear the service is being called.

Image


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 5:15 pm
by Sergey Kozyr

Do you call Rest service on page load or on some other event?


Local storage variable not mapping to request?

Posted: Wed May 08, 2013 5:21 pm
by Nathanael

Gah, that was it. For some reason, I completely forgot that the service has to be invoked, even when it's tied to the screen. I just assumed it was automatic. Thanks for your help and time!