casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

basic query

Hello, I have created a service to query a DB. I have added the data source to the page. When I go to edit mapping can not find out any instruction on how to use the "where" request. I can test the service and input "{ColumnName":ColumData"} and I will return the single row correctly. I am setting the variable I want to query for as local storage but I guess I am confused about how to set the column Name I want to send this request for. Thanks.

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

basic query

Hello,

If you have two variables in localStorage with names ColumnName and ColumnData, then you should add to the parameter where the following JS:

return '{' + localStorage.getItem("ColumnName") + ':' + localStorage.getItem("ColumData") + '}';

casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

basic query

Thank for getting back so fast.. Im actually doing this...

var P1 = localStorage.getItem("Part1_Part_Number");

return '{' + "PartNumb" + ':' + P1 + '}';

for some reason the query is triggering the error event. The local storage variable is set on button click right before the service is invoked..

"PartNumb" is the column. Even when I change the "P1" to "CCCC" which is a actual part number it triggers the error event.

casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

basic query

I think i may have got it.. instead of using a local storage variable i did this...

return '{"PartNumb":"'+value+'"}'; and also mapped the input field to get the value..

thank you for your help... you got me going in the right direction.

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

basic query

Hi,

Yes, you can do it in this way, if you do not have to change the column dynamically, Glad to know that you got it.

Return to “Issues”