Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

Query Service??

I think I just need some simple Javascript in the where parameter "Add Javascript".
But all that I've tried has not worked.
Here's what I am trying to do:

I have a collection: "Athletes" and have set up the Query service and mapped the results to a list "athlete_List"(my List service works so I know my mappings are good and should be the same for the Query Service).

Columns in Athletes collection:
raceID | Name | Email

On transition from page1 to page2 I store a local variable "raceIDLocalVar". Which matches one of the raceID's.

In page2 in the "athlete_List" I want something like:

Javascript pseudo code:
If raceID of Athletes matches raceIDLocalVar
then
return the Name

Thanks...

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Query Service??

Do you have any errors? Can you post you Javascript code?

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

Query Service??

I dont think my code is even worth posting. If you could point me in the right direction, I would really appreciate it.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Query Service??

It should be something like this:
code
if (localStorage.raceID==localStorage.raceIDLocalVar) {
return Name;
}
/code

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

Query Service??

this is what I tried:

var x = localStorage.getItem("raceIDLocalVar");

if("raceID" == x )
{
return "Name";
}

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

Query Service??

raceID and Name are in the database, not local

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

Query Service??

Did you check/test that localStorage.getItem("raceIDLocalVar") returns the correct value?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Query Service??

Add next javascript code to map field "Name".
Image
code
var x = value;
localStorage.setItem("raceIDLocalVar", "set_some_value_here");
if (x==localStorage.raceIDLocalVar) {
return x;
}
/code
or you can Set local storage variable "raceIDLocalVar" to input field element.

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

Query Service??

Yes, it does. On page2 Load I Run Javascript
var x = localStorage.getItem("raceIDLocalVar");
alert(x);

Which shows the correct value.

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

Query Service??

Thanks Igor but I think you should read my original post again.

Return to “Issues”