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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

dynamically adding row to table loses calculation scripts in table.

Avatar

Level 2

Hi Adobe Forum,

I'm not sure I'm not out of my depth, however I'm trying to build a dynamic timesheet in Adobe LiveCycle Designer 8.05. (windows 7 environment)

I've pretty much got it all working with reading and writing to an Access database, etc. I'm stuck on one feature though:

I want to be able to add rows to a table, each row contains a number of cells for the input of time data (hours), and the last two columns of each row are subtotals with calculation scripts for the sum of the hours in the row. One for business hours, and one for after hours totals. A row represents a task that has been undertaken.

A single row works just fine. As soon as I use instanceManager.addInstance to add a new row for a new task, the calculate scripts seem to stop. I'm assuming that the instanceManager does not propogate the scripts held in the calculate event (probably for no event in the added object), is this correct?

Would the answer be to use the calculate event from another object to populate the sub-total fields with the sum of the hours in each of the rows, row by row? If it is, I'm having trouble referencing the data in each cell in each row to generate the row's sub-total. Can anyone point me in the right direction on referencing dynamically added table cells please?

Thanking you in advance,

David.

0 Replies

Avatar

Level 10

Hi David,

If you give the full reference of the object in your script then it may get confused which row you are referring to when there is more than one row.

For example:

this.rawValue = form1.Table1.Row1.mondayHours.rawValue + form1.Table1.Row1.tuesdayHours.rawValue + ...

When you add instances of a repeating row, each instance is assigned a number (zero based). So Row1 becomes:

Row1[0]

Row1[1]

Row1[2]

...

Row1[n]

If you shorten the object references to just their names, then Acrobat will assume that the script refers to the objects in that row only:

this.rawValue = mondayHours.rawValue + tuesdayHours.rawValue + ...

This should work,

Niall

Avatar

Level 2

Hi Niall,

see what happens when you think too much! I was expecting to have to deal with the row ordinals but I didn't. LiveCycle impresses me more and more.

Your suggestion was spot on and worked a treat, thank you. My final script looks like this:

this.rawValue = xfa.resolveNode("Form1.Timesheet.TaskDetail.Times.Row.MonBH").rawValue +
     xfa.resolveNode("Form1.Timesheet.TaskDetail.Times.Row.TueBH").rawValue +
     xfa.resolveNode("Form1.Timesheet.TaskDetail.Times.Row.WedBH").rawValue +
     xfa.resolveNode("Form1.Timesheet.TaskDetail.Times.Row.ThuBH").rawValue +
     xfa.resolveNode("Form1.Timesheet.TaskDetail.Times.Row.FriBH").rawValue;

Thanks again.

Kind regards,

Dave.

Avatar

Level 10

Glad you got it working Dave.

Just one small thing. You should not have to resolve the nodes, as the objects are in the same row. It uses resources to resolve the nodes, especially when there are multiple rows. the following should work:

this.rawValue = MonBH.rawValue + TueBH.rawValue + WedBH.rawValue + ThuBH.rawValue + FriBH.rawValue;

This is leaner script,

Niall

Avatar

Level 2

Hi Niall,

you're correct again. That worked.  Thanks very much.

Kind regards,

Dave.