cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying a specific row in a subform/table

Former Member
0 Kudos

Dear,

I've got an Enterprise Service that retrieves Materials, I created a SubForm (that can grow dynamically, it already does this) to list all the items with some detail fields.

Retrieving one item is no problem, the first instance of the subform will be created and the data will be filled in. Using this code :

var nCount = 0;
var nLimit = 10;

for(var nItemCount in oItems)
{
	_sf_Row.addInstance(1);
	for(var nItemNode in oItems[nItemCount])
	{
		if (nItemNode == "MATNR")
		{
			sf_Row.txt_Matnr.rawValue = oItems[nItemCount][nItemNode];
		}
		if (nItemNode == "MAKTX")
		{
			sf_Row.txt_Maktx.rawValue = oItems[nItemCount][nItemNode];
		}
		if (nItemNode == "MATKL")
		{
			sf_Row.txt_Matkl.rawValue = oItems[nItemCount][nItemNode];
		}
		if (nItemNode == "MEINS")
		{
			sf_Row.txt_Meins.rawValue = oItems[nItemCount][nItemNode];
		}
		if (nItemNode == "MTART")
		{
			sf_Row.txt_Mtart.rawValue = oItems[nItemCount][nItemNode];
		}
	}
	if ( ++nCount >= nLimit )
		break;
}

As you can see here, I just fill up the Subform directly. (the subform is named sf_Row)

I've tried all possible combinations to fill up a specific row in the subform table, but they all give JavaScript errors ...

sf_Row[nCount].txt ...

sf_Row(nCount).txt ...

And a bunch of others ...

It's a fairly simple question though I've completely ground to a halt in developing this part.

Edit : nCount is a counter starting from 0 to a max of 10 rows to be shown (the max in my search for this demo)

Any help would be greatly appreciated!

Cheers,

Frederik-Jan

Edited by: Frederik-Jan Roose on Mar 4, 2009 4:21 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Frederik-Jan,

You have to use the method resolveNode. It takes a parameter which is a SOM expression.

Example:

xfa.resolveNode("xfa.form.data.TABELLE.ROW[1].NAME");

this.resolveNode is relative to the field the script is running for.

Regards,

Juergen

Former Member
0 Kudos

I thought resolveNode was only to get data out of a node? I need to get data in it, how would this work with resolveNode?

Former Member
0 Kudos

That worked readily enough, I had always assumed resolveNode was for retrieving data only, it isn't

xfa.resolveNode("xfa.form.data.sf_Body.sf_Row[" + nCount + "]").txt_Matnr.rawValue  = oItems[nItemCount][nItemNode];

Cheers

Answers (0)