cancel
Showing results for 
Search instead for 
Did you mean: 

Fill text field in table dynamically

Former Member
0 Kudos

Hi there,

I've a table which consists of 5 columns.

The first column is not binded and should be filled with a concatenated string of two fields of the following context node:

|- IT_ITEM

|-- ARKTX

|-- TEXT

I know how to fill a text field dynamically (with JavaScript) via e.g.

xfa.record.IS_HEADER.NAME1_WE.value

, but not how to do that within a table. For instance, how can I access the value of fields ARKTX and TEXT for each table line?

I use the following subforms (type table and body item):

|- POSITIONS (binded to $record.IT_ITEM)

|-- DATA1 (binded to DATA[*]).

I tried to use something like

xfa.datasets.data.IT_ITEM...

, but it didn't work.

A second question:

Is it possible to have two lines in the table for each entry of IT_ITEM? How can I manage that? Do I have to include a DATA2 subform to the POSITIONS table?

I tried that, but the second line was not displayed.

Can you provide me links to tutorials for ADOBE forms to help me with these problems?

THANKS.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member365727
Active Contributor
0 Kudos

Hi Eddie,

If I understood your question correctly,

1) You have a table with 5 rows and would like to set the values in each table row at runtime using script.

Lets call your table as 'objTable'.

loop through the table to get the number of rows and get/set the values.


for(var i = 0; i<objTable.nodes.length; i++)
{
     var oChildNode = objTable.nodes.item(i);   //provides access to individual row
     oChildNode.<columnA>.rawValue = "11";  //provides access to columnA of row1, and set the value to '11'
     oChildNode.<columnB>.rawValue = "12";
}

2) For the second question I beileve what you need is to have option of displaying the entire value without truncating.

Click on the field for which you require multiple lines, in the 'Object palette' enable the check box 'Multiple lines'.

Regards

Srikanth KV

Former Member
0 Kudos

First of all, thanks for your answers..

But unforunately that didin't solve my problem.

Ok, again: In my context I have the table IT_ITEM.

I want to display the values in a table on my form.

This is already working.

The problem is that I want to concatenate the two fields ARKTX and TEXT of IT_ITEM in the the text field ARKTX via Javascript when the table is generated.

But I do not know hat to get the values of the field ARKTX and TEXT during runtime. I don't need a FOR loop within my JavaScript, but access to the dynamic index to read the actual entry of IT_ITEM when the table is generated.

I tried things like

xfa.datasets.data.IT_ITEM.ARKTX.rawValue

or

xfa.datasets.data.IT_ITEM.DATA[*]ARKTX.rawValue

without success.

former_member365727
Active Contributor
0 Kudos

Hi,

Are you using any Webdynpro script provided by SAP. It comes as a part of standard in R/3.

Regards

Srikanth KV

Former Member
0 Kudos

No, I am not running any webdynpro script.

This form is used for printing out invoices and is calles via a function module generated in the Form builder.

former_member365727
Active Contributor
0 Kudos

Hi,

I hope the below code will help you out in this:

xfa.record.IT_ITEM.ARKTX.value;

Regards

Srikanth KV

Former Member
0 Kudos

Ok, as usual I found the solution on my own, although I thought that this would be an easy task for all the "professionals" here. But it seems that most of the people here are experts in doing copy and paste of shallow introductions just to get their points.

If you ask for concrete answers most of them have nothing to say...

Here's the solution:

var currentIndex  = this.parent.index;
var it_item_arktx = xfa.resolveNodes("data.BodyPage.Positions.Line[*].ARKTX");
var it_item_text  = xfa.resolveNodes("data.BodyPage.Positions.Line[*].TEXT");

var str           = it_item_arktx.item(currentIndex).rawValue + "\n" + it_item_text.item(currentIndex).rawValue;
str = str.replace(/null/g,'');

this.rawValue 		   = str;

What a pity, that I cannot reqard points to myself

But to be honest: I don't give a damn...

Former Member
0 Kudos

Hi Eddie

Could you please tell me where I place your suddgested codes ? (i.e. at the cell - Javascript code or Row?) - I'm new with Adobe Form and learning it thru SDN as there are very little of doco available (also my xfa.resoveNodes.....statement doesnot work at all ? Can't understand why)

I will really appreciated If you could send me a reply - to save me many days of trying to sort this out - Thanks

Former Member
0 Kudos

Hello Eddie,

ARKTX & TEXT table fields or ?

What does mean 2 lines? Can u give example