Expand my Community achievements bar.

Copy Script through Cels Like Excel

Avatar

Level 2

I have a form I'm building in LiveCycle Designer ES that has a large table.  I have written script to add three cells together.  In Excel, I can drag the calculated cell down, and the formula copies all the way down, as far as I drag it, and the formula automatically enters the adjacent fields so the formula works all through the columns.  Is it possible to do the same with my table in LiveCycle?  It will be incredibly time consuming to write the same script down the columns, and making sure the adjacent cells are referenced in the fomulated cell.

I hope this makes scence....

Thank you!

Robert

1 Reply

Avatar

Level 10

Hi,

There is a way to achieve this, but it depends on how you have set up your table.

Leaving aside header rows and footer rows, most tables will have a series of rows: Row1, Row2, etc. Inside each row there may be a series of cells: Cell1, Cell2, Cell3.

If you want the value of Cell3 to be the multiplication of Cell1 and Cell2, then you can have the following in the calculate event of Cell3:

this.rawValue = Cell1.rawValue * Cell2.rawValue; 

Now you will see that we haven't referenced the row at all. This means that the calculation ignores the values of Cell1 and Cell2 in other rows and just works with the values in the row that the calculation is taking place.

Set the calculation up for Row1 and then copy Cell3. Then select ALL of the Cell3 in other rows and paste. This will paste the calculation into the other rows. As long as the Cell1 and Cell2 are called the same in the other rows the calculation will work.

Hope this helps,

Niall