cancel
Showing results for 
Search instead for 
Did you mean: 

Table read issue using Java Script

former_member226239
Contributor
0 Kudos

Hi All,

I want to read the content of a table row.

I tried the dynamic approach:

var x = xfa.resolveNode("mainpage.table.row\["\+i\+"\].field1").rawValue;

I got some value but that is not the value stored in the table. It is very weird. Please let me know what mistake I am doing.

even I tried the static way:

var x = xfa.resolveNode("mainpage.table.row[2].field1").rawValue;

In this case also I got a value which is not stored in the table. but the value in both the cases are same.

Another question:

Can't I use the following statement to get the static row field value.

var x = mainpage.table.row[1].field1.rawValue;

Appreciate your help.

Thanks,

Chandra Indukuri

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

Hello,

you should start reading here:

http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

maybe it will make you happy that the last chapter is about the ready-to-use examples/ typical problems and their solution.

Hope this will solve this and many other future problems of yours,

regards, Otto

Answers (2)

Answers (2)

former_member226239
Contributor
0 Kudos

Simple mistake.

Shouldn't use x as a variable. Because 'x' is a script property.

chintan_virani
Active Contributor
0 Kudos

It should be

var x = mainpage.table.row1.field1.rawValue;  // First row, Assuming field1 is name of field you are using.

The code to read Table through JavaScript has been discussed here at SCN. You may Search for it and check your code.

Former Member
0 Kudos

Hi Chandra

Below is an example of calculating a total (from the LCD ES Scripting Reference).

var oFields = xfa.resolveNodes("Subform2[*].NumericField4");
var nNodesLength = oFields.length;
var nSum = 0;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) 
{
nSum += oFields.item(nNodeCount).rawValue;
}
TextField1.rawValue = nSum;

As you can see, the first line resolves all the nodes that exist for Subform2. It then loops through them individually.

Perhaps try to adapt the code above to suit your suborms and tables/fields.

Kind regards,

Casper