Get Local variable to cocatenate with Listitem text field.

This forum contains topics that were moved from Get Satisfaction
Frank Lichtlin
Posts: 0
Joined: Thu May 21, 2015 3:43 pm

Get Local variable to cocatenate with Listitem text field.

Post by Frank Lichtlin »

I am trying to combine 2 variables into the text field of a Listitem.

I have a model object of player that consists of name, link and number. Then I have another model playerList that is an array of type player.

I have a local storage players that is of type playerList. I have all my service response variables mapped to the local storage.

Then I am mapping my local storage name to the listitem Text field and have the following JS attached.

var playerNum = Apperyio.storage.storageVariable.get("$['players']['nmbr']");
return playerNum + " " + value;

It is not grabbing the Local Storge Variable I need for nmbr and is just giving my name mapping.

Any help would be appreciated?

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

Get Local variable to cocatenate with Listitem text field.

Post by Serhii Kulibaba »

Hello Frank,

Please add JS to the mapping array to the list item. This code should read data from children elements and write them to the list item. E.g.:

element.find("[name=mobilelistitemName]").text(value.param1 + value.param2);

here:
mobilelistitemName - name of the list item component
value - item of the array from mapping (e.g "players")
param1/param2 - value of item's children elements (e.g. "nmbr")

Frank Lichtlin
Posts: 0
Joined: Thu May 21, 2015 3:43 pm

Get Local variable to cocatenate with Listitem text field.

Post by Frank Lichtlin »

I have tried adding this code to the mapping you suggested and no luck.

element.find("[name=mobilelistitem_11]").text(players.nmbr);

Attached are 2 screen shots of mapping.

Image

Image

Thanks!

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

Get Local variable to cocatenate with Listitem text field.

Post by Serhii Kulibaba »

Please change
element.find("[name=mobilelistitem_11]").text(players.nmbr);
to
element.find("[name=mobilelistitem_11]").text(value.nmbr);

Frank Lichtlin
Posts: 0
Joined: Thu May 21, 2015 3:43 pm

Get Local variable to cocatenate with Listitem text field.

Post by Frank Lichtlin »

Thanks for trying to help, but that doesn't seem to work either.

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

Get Local variable to cocatenate with Listitem text field.

Post by Yurii Orishchuk »

Hi Frank,

Please use following JS code instead of yours:

pre

element.text(value.nmbr);

/pre

Regards.

Post Reply