cancel
Showing results for 
Search instead for 
Did you mean: 

Fill text field in table dynamically (part 2)

Former Member
0 Kudos

Hi,

I am nearly going crazy (see also [here|;)...

So, here are the facts:

- Lifecycle designer 8

I have a Table POSITIONS which consists of 2 columns.

|-data

|--BodyPage (binding: none, )

|---- POSITIONS (binding: $record.IT_ITEM)

|------ LINE (binding: DATA[*], repeat row for each data item)

|----


WAERK (binding: WAERK)

|----


NETWR (binding: NETWR)

I want to concatenate field WAERK and NETWR into field NETWR.

I tried thouthands of possible codings, but I always get the value WAERK twice in my field NETWR...

E.g. I tried on hierarchy level "data" at event "ready:form":

var it_item_waerk = xfa.resolveNodes("data.BodyPage.Positions.Line[*].WAERK");
var it_item_netwr = xfa.resolveNodes("data.BodyPage.Positions.Line[*].NETWR")

for (var i = 0; i < it_item_waerk.length; i++) {
  xfa.host.messageBox("I: " + i);
  xfa.host.messageBox("WAERK: " + it_item_waerk.item(i).rawValue + " NETWR1: " + it_item_netwr.item(i).rawValue);

  it_item_netwr.item(i).rawValue = it_item_waerk.item(i).rawValue + " " +
it_item_netwr.item(i).rawValue;
  xfa.host.messageBox("NETWR2: " + it_item_netwr.item(i).rawValue);
}

But in the second message box the value

it_item_netwr.item(i).rawValue

already contains the value

it_item_waerk.item(i).rawValue

although the concatenation is in the folowing step

it_item_netwr.item(i).rawValue = it_item_waerk.item(i).rawValue + " " +
 it_item_netwr.item(i).rawValue;

In the end the value NETWR contains WAERK twice (e.g. "USD USD 123")...

In addition to that the value "I" always jumps from 0 to its real value without clicking the "OK" button of the message box...

Who can give me an explanation for that?

Which event should I use for my coding?

THANKS.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Can you try as below.

Place a 3rd field, in the LINE subform with no binding. and hide the NETWR and WAERK fields.

On that field write script in form: ready; formcalc

text1 = $.parent.NETWR

text2 = $.parent.WAERK

$ = Concat(text1, text2)

May be in your coding you are using the same field for the next iteration also. try to clear the value for each iteration.

pavan meda

Former Member
0 Kudos

Hello

try the same code with out binding the NETWR field in the form.

By default when form loads these concatenation vales need to display in NETWR , best place is initilize method of NETWR.

Regards.

malli