Page 1 of 1

Mapping specific element in array

Posted: Mon Apr 27, 2015 11:42 am
by Juan Pieterse

In the example below I'd like to map a value from a service response to a local storage variable.
I KNOW the service response gives me an array, but how do I get a handle on the FIRST FirstName in the service resonse's array.
(In this case I'm only interested in the FIRST element of the array, as I'm only expecting one value to be returned)

I guess I need to enter the JS section of the storage input, but I don't know what (input) variable to address for this. The javascript should basically return
the first FirstName in the "input" array.

Help would be greatly appreciated :)

Image


Mapping specific element in array

Posted: Mon Apr 27, 2015 2:00 pm
by Serhii Kulibaba

Hello Juan,

You are right, you should use JS.

Add handler on service success event, full service responce will be able in variable "data".


Mapping specific element in array

Posted: Mon Apr 27, 2015 2:18 pm
by Juan Pieterse

Cool! - Is there any code examples somewhere?
How would I, for instance get a handle on the first 'FirstName' variable?
Thanks for the quick response.You guys are great!


Mapping specific element in array

Posted: Mon Apr 27, 2015 7:44 pm
by Juan Pieterse

Cool! - Is there any code examples somewhere?
How would I, for instance get a handle on the first 'FirstName' variable?
Thanks for the quick response.You guys are great!


Mapping specific element in array

Posted: Tue Apr 28, 2015 6:52 am
by Serhii Kulibaba

Use JS below to get FirstName of the first item:
var FirstName = data[0].FirstName;