David6727976
Posts: 0
Joined: Tue Mar 11, 2014 9:52 pm

How do i add values in a label field together and place the answer into another label filed

Please could you assist.
How can i take numbers entered into a label field, add them together and display the answer into another label field on the same page.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How do i add values in a label field together and place the answer into another label filed

Hi David -

How you enter values in the label component?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How do i add values in a label field together and place the answer into another label filed

It very depends where and when you are have to do it.

So the simplest way (when target legends are on the page and filled by their values) is to use next code:
pre
//Get values of existing labels.
var labelFirstNameText = Appery("label_firstName").text();
var labelSecondNameText = Appery("label_secondName").text();

//Combine two values together.
var labelFullNameText = labelFirstNameText + " " + labelSecondNameText;

//Populate full name label by resulting value.
Appery("label_fullName").text(labelFullNameText);
/pre

Regards.

Return to “Issues”