Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

instantmanager count not work in javascript

Avatar

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
aka44356106
Level 2

20-10-2019

i have a table in dynamic form with two row and a button to add inatance in second row

second row initial count set to zero

i copy both row data in a  text-field

i set initial count for second row 0

var fields = xfa.resolveNodes("Table6.Row2[*].Cell1");

var total = 0;for (var i=0; i <= fields.length-1; i++)

{total = total + fields.item(i).formattedValueValue;}

this.rawValue = Table6.Row2.instanceManager.count ==0 ? "(i) Item 1" + xfa.resolveNode("Table6.Row1.Cell").formattedValue : "(i) itme1 " + xfa.resolveNode("Table6.Row1.Cell1").formattedValue + "\n(ii) item2 " + total;

but it not worked and always show second row data

plz help to correct script

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

25-10-2019

So far ist not clear, what kind of field your're using. And your script has some flaws or typos  – see the comments.

var fields = xfa.resolveNodes("Table6.Row2[*].Cell1");

var total = 0;

// a property "formattedValueValue" does not exist

// What type of field is Cell1 – text or numeric?

for (var i=0; i <= fields.length-1; i++) {

total = total + fields.item(i).formattedValueValue;

}

// Is it "Table6.Row1.Cell" or "Table6.Row1.Cell1"?

// What type of field is it – text or numeric?

this.rawValue = Table6.Row2.instanceManager.count == 0 ? "(i) Item 1" + xfa.resolveNode("Table6.Row1.Cell").formattedValue

: "(i) itme1 " + xfa.resolveNode("Table6.Row1.Cell1").formattedValue + "\n(ii) item2 " + total;

However, I guess this should do the trick.

var oRow2Cells = xfa.resolveNodes("Table6.Row2[*].Cell1"),

oRow1Cell = xfa.resolveNode("Table6.Row1.Cell1"),

nTotal = 0,

i;

for (i = 0; i < oRow2Cells.length; i += 1) {

nTotal += parseFloat(oRow2Cells.formattedValue);

}

this.rawValue = "(i) Item 1" + parseFloat(oRow1Cell.formattedValue) + (oRow2Cells.length > 0 ? ("\n(ii) item2 " + nTotal) : "");

Answers (0)