Page 1 of 2

Multiple Value Mapping into one field

Posted: Fri Jan 31, 2014 3:56 pm
by Nathan Friend

I am trying to map service output values into one field. The service returns multiple datasets in a grid. How would I combine the address values returned before it moves to the next set of data in the response?


Multiple Value Mapping into one field

Posted: Fri Jan 31, 2014 6:29 pm
by Kateryna Grynko

Hi Nathan,

You can map 2 data fields to one component and then merge them using such JS:prereturn element.text() + value;/pre


Multiple Value Mapping into one field

Posted: Fri Jan 31, 2014 7:36 pm
by Nathan Friend

Thank you. How would I go about manipulating that string of data? For example, the fields I am mapping are as follows:

Street + City + State + Zipcode

Right now those values all run together when mapped to one component. I would like to add spaces and comma's to the string to format it properly. Could you explain how that would be done?


Multiple Value Mapping into one field

Posted: Fri Jan 31, 2014 8:21 pm
by Kateryna Grynko

Nathan,

Something like this: preStreet + ", " + City + ", " + State + ", " + Zipcode/pre


Multiple Value Mapping into one field

Posted: Fri Jan 31, 2014 8:31 pm
by Nathan Friend

I hate to be dumb, but could you explain that a little further please?


Multiple Value Mapping into one field

Posted: Fri Jan 31, 2014 9:10 pm
by Kateryna Grynko

Nathan,

If the order of received data suits you, you can do this way.prevar count = (element.text().split(',').length - 1); // calculate a number of commas added to a label
var comma = (count != 3)? "," : ""; //if there are 3 commas added, then don't add in the end
return element.text() + value + comma; //add a new value to a text + comma /preThis is the simplest approach.


Multiple Value Mapping into one field

Posted: Mon Aug 17, 2015 9:05 pm
by Jack Bua

Kateryna,

I understand your response to this post. I would like to know how I could go one step farther and map 2 values from the response, but both values are from a pointer that is included in the response.

Image

How would I do this?

Additionally, how would I map two values that come from an included pointer object inside an included pointer object inside the service response?

Image


Multiple Value Mapping into one field

Posted: Fri Aug 21, 2015 5:36 pm
by Serhii Kulibaba

Hello Jack,

Please use JS of mapping from $ to field.
all item's data will be able in "value" variable.

E.g.:
return value.employee_ptr.username + " " + value.job_ptr.username;


Multiple Value Mapping into one field

Posted: Sat Aug 22, 2015 6:43 am
by Jack Bua

Thank you Sergiy, that worked.

Last question. How would I do the same exact thing if I was trying to get from a storage variable (that is NOT an array) instead of a request?


Multiple Value Mapping into one field

Posted: Sun Aug 23, 2015 10:43 am
by Serhii Kulibaba

You have to add mapping from the parent element to the field, then use the same JS as for array