Page 1 of 1

How to use the "Where" clause in a List Service Query

Posted: Wed Mar 26, 2014 6:58 pm
by Crystal Ege

I'm building an app with nested lists that navigate to separate pages and display another list based upon the previous selection.

I have been able to produce list results in the where clause by using the test tab on the list service. I am also able to produce results when for example {"ParentId":"101"} is entered in the Request tab of the data service on a page.

My database has multiple fields. I am working with CatalogComponentId and ParentId. I am attempting to use a local storage variable to hold the value of CatalogComponentId and then use that variable as the ParentId value.

I am using the following code to retrieve the local storage variable and assign it the ParentId in the sub-pages where clause. But it is not working.

var value = localStorage.getItem('CatalogComponentId');
return {"ParentId": value };

Please help!


How to use the "Where" clause in a List Service Query

Posted: Wed Mar 26, 2014 7:50 pm
by Nikita

Hello,

Please replace
return {"ParentId": value };
with
return '{"ParentId":"' + value +'"}';


How to use the "Where" clause in a List Service Query

Posted: Wed Mar 26, 2014 8:12 pm
by Crystal Ege

Thanks!!