w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

change values during mapping

How to change the value of a service response while mapping? For example, an array of telephone numbers is mapped to a grid.

I want to change the value of the telephone numbers dynamically, based upon the value that is being received.

w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

change values during mapping

Now i have this in the "edit js" section of the mobile grid:

if (value.DIASType_obj == "15580.100001" ) {
value.CleanedValue = "+" + str.pop();
}
return value;

Image

w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

change values during mapping

Everything in the "edit js" section is working (the str variable is initialized before) according to the console.log that i did. It is just that value.CleanedValue doesn't get a new value, it just shows the initial value in the grid. It is like the statement "value.CleanedValue = xxx" doesn't change the actual value.CleanedValue

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

change values during mapping

You can't change value.CleanedValue in mapping
"value" is a local variable.
If you need to set lblCommunicatieValue.text depending on DIASType_obj value then you can just set the value manually in JS (without mapping from CleanedValue to lblCommunicatieValue.text).
Change your JS in mapping:
precodeif (value.DIASType_obj == "15580.100001" ) {
$('[dsid=lblCommunicatieValue]', element).text("+" + str.pop());
} else { //you need this section because now there is no mapping from CleanedValue to lblCommunicatieValue.text
$('[dsid=lblCommunicatieValue]', element).text(value.CleanedValue);
}
/code/pre

w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

change values during mapping

If value is a local value, what is the "return value" statement for in the "edit js" sections?
Also, if you do "return 'xxx' " in the "edit js" section of lblCommunicatieValue, then the 'xxx' is shown in the label, how does that work then?

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

change values during mapping

Returned value is used as new value for this particular component.

Return to “Issues”