BSalita
Posts: 0
Joined: Tue Jul 16, 2013 8:48 pm

How to Specify a Local Storage Variable as the Where Value?

How can a local storage variable be specified as the Where value in a query service request?

I navigated in the IDE to my Query Service-Request-Where-Value and set Where's Value to

Code: Select all

 localStorage.getItem('SelectedPosition') 

Where SelectedPosition is a local storage variable confirmed to contain: {"Name": "GOOG"} Hard coding the string in Value and clicking Test works fine. Shouldn't the above expression work or is there some additional magic required?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to Specify a Local Storage Variable as the Where Value?

Hi BSalita,

Please follow this solution:

1 Open your service mapping.
2 Find "where" request parameter.
3 Click "JS" on this "where" parameter.
5 Populate JS editor with following code:

pre

//Note: you should replace "SelectedPosition" with your lsv name.
var selected = localStorage.getItem("SelectedPosition");

var whereObject = {"Name": selected};

return JSON.stringify(whereObject);

/pre

That's all.

Regards.

BSalita
Posts: 0
Joined: Tue Jul 16, 2013 8:48 pm

How to Specify a Local Storage Variable as the Where Value?

I don't see "JS" on the "where" parameter. Is it really on the new UI screens? I think the issue is that I've never seen "JS" in the new UI but IIRC I saw it in the old UI. Perhaps I'm not understanding what is meant by "service mapping".

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to Specify a Local Storage Variable as the Where Value?

Hello,

Actually, request mapping is 'Before send' and response mapping in 'Success' now. Please find them in your service.

BSalita
Posts: 0
Joined: Tue Jul 16, 2013 8:48 pm

How to Specify a Local Storage Variable as the Where Value?

This question has revealed a number of UI issues:

  1. If you delete the default "Before send-Mapping" and "Success-Mapping", the data source page has no way of showing the "Add" button again. Even if you create events, it still won't show "Before send" and "Success" Add buttons, only the events are shown.

  2. There's no title to this page and some other UI pages. The URL doesn't contain a page identifier. Thus, it is difficult to explain to a user, and visa-versa, which page you are on and where you should be. Every UI page needs a unique, descriptive title.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to Specify a Local Storage Variable as the Where Value?

Hi BSalita,

  1. Here is how to add event if you delete it: http://prntscr.com/4s9zy9/direct

  2. Every page has ID in URL.
    See details: http://prntscr.com/4sa0x8/direct

    Regards.

Return to “Issues”