Chris McKenna6917608
Posts: 0
Joined: Sat Jun 07, 2014 2:12 am

Mapping multiple responses from a service to the same component

Any chance of getting this in a tutorial? I would like to do the same thing. I am trying to follow, but i get a little lost after about 5 posts.

I want to map firstName and lastName from the database to a listItem Text .

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

Mapping multiple responses from a service to the same component

Hi Chris,

Please follow these steps to understand how do it:

1 Open your service mapping.

2 Delete all links from this mapping.

3 Add in mapping following LSVs "firstName", "lastName". http://prntscr.com/3u8dxz/direct

4 Make following links: "firstName"(response)-"firstName"(lsv), "secondName"(response)-"secondName"(lsv). http://prntscr.com/3u8ekb/direct

5 Make mapping from some response field to your text component. http://prntscr.com/3u8fg6/direct

6 Click "AddJS" on the text component link. And fill it with following code: http://prntscr.com/3u8h78/direct

pre

var firstName = localStorage.getItem("firstName");

var lastName = localStorage.getItem("lastName");

var goalText = firstName + "" + lastName;

return goalText;

/pre

That's all.

Please follow this solution step-by-step. And don't confuse steps by order.

Regards.

Abhijeet Singh
Posts: 0
Joined: Thu May 08, 2014 5:54 pm

Mapping multiple responses from a service to the same component

how do i add or substract two different vaules, one from a local storage variable and another from slider, and map it (request mapping) to a single component?

Ravenight
Posts: 0
Joined: Sun Jan 11, 2015 3:43 pm

Mapping multiple responses from a service to the same component

I have followed these instructions but if you add a list of people - with firstName, lastName - and connect the list (response) to the nameList so it populates with all the names, only the first entry's goalText is shown for all the entries on the list.

How do you combine firstName + lastName for each item in a list?

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

Mapping multiple responses from a service to the same component

Hi Clif,

In new builder you can use following solution:

  1. Make link from "$" to needed label.
    Details: http://prntscr.com/5re17j/direct

  2. Click for "JS" on this link and use following JS code:

    pre

    //Where - "firstName" and "secondName" - are needed response parameters.
    var resultText = value.firstName + ", " + value.secondName;

    return resultText;

    /pre

    Regards.

Jean-Marc Nourel
Posts: 0
Joined: Thu Mar 31, 2016 10:32 am

Mapping multiple responses from a service to the same component

Hi,

When doing so it's working perfectly to display my item and the created date.
But I would like now to have each one on a separate line.
How can I do it ?

Thanks

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Mapping multiple responses from a service to the same component

Hello Jean,

Please use Newline symbol for that ("\n"), e.g. set in insead of the space from the suggestion of Yurii

Return to “Issues”