Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

Ok I call a service it returns an array of id's, that are relevant. I have a custom collection in my database that are populated with the exact same id's plus more columns with other information, but I need to only list the ones that the service and other factors have determined are relevant. Well actually I don't need to list the Id's but I need to list the other columns of data associated with those id's. How can I call my database and read these other columns associated with my id's. EX. My column is EventId: with string 4544 and its related column EventName: with string Robert. So I have called my api I know that the EventID: is 4544 so now I need to read my database and find EventId: 4544 but list EventName: Robert in my service mapping. How do I do this without using the assigned ObjectId in the database, because the api I call does not know the automatically generated ObjectId? And at the same time im not just calling one object but an entire array of these id's. Image Imageinline.png?1390634636[/img] [/url]

Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

Also one other thing, I did try mapping the EventId from API Rest Service to LSV then Added a Query service for my back-end. And mapped the LSV to the "where" Request on the Query service. But When I do this I only get one result in my list not the whole array.

Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

I have managed to duplicate a single response from my database the way I want it but I am still only receiving one listing instead of several. I mapped event_id from rest service out to LSV EventID then mapped LSV EventId into Query Where added some code, then mapped to my labels. Image Imageinline.png?1390642150[/img] [/url] Image Imageinline.png?1390642180[/img] [/url] Image Imageinline.png?1390642273[/img] [/url]

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Read Database

Hi Robert -

Do you want to make query from your DataBase or from the service?

Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

From the database, I'm not even sure that's the correct thing to be doing.

Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

Ok, I see my problem now. When I map my LSV to "Where" it is only passing the first key in the LSV String. What JS do I need to add to mapping on where? Also depending on other elements the LSV could have in between 1 and 16 keys. I have tried this code

return '{"EventId":"'+value+'"}';

And it only returns one result in my UI because I believe I am only picking up the one +value+. Is there anyway to pass all of the key values to the query and then have their data returned?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Read Database

Hello Robert,

Can you show the content of this when running:
pre
alert('{"EventId": ' + value + '}');/pre

Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

This is the key being sent to the "where" request for the query DB from the LSV.
Image
And here is all the keys coming from the Rest API and being saved to the LSV.
Imageinline.png?1390724763[/img] [/url] Image Imageinline.png?1390724790[/img] [/url]
Plus many more but I will save you from all the screenshots. I have my Rest service fire first on page load saving the keys to the LSV. Then My Query DB Service fires second taking my keys from the LSV to the "where" Request. And you can see in my last screenshot I only have one list item filling in the top list.
Image
Each key is for a different row in the collection, so say.... 9 keys I need to have 9 list items populate the top list not just 1.

Robert Larsen
Posts: 0
Joined: Fri Aug 02, 2013 6:56 am

Read Database

Any help would be appreciated.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Read Database

Hello! Sorry for a late reply.
1) "When I map my LSV to "Where" it is only passing the first key in the LSV String. What JS do I need to add to mapping on where?" - could you clarify what do you mean on "first key in the LSV String"? What is stored in LSV?
2) On screenshot https://d2r1vs3d9006ap.cloudfront.net... you map event_id from response (response is array) to localStorage variable - it's not corrcet. Every new value will overwrite previous one. To make all event_id from response stored in event_id localStorage variable as array on service success event add the following code: prevar event_id = [];
data.forEach(function(elem){
event_id.push(elem["event_id"]);
});
localStorage.setItem("event_id", event_id);/pre

Return to “Issues”