Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Dynamic Table and Rounding numbers

Avatar

Level 2

https://acrobat.com/#d=Q4mPXOglMmVaowXHe8urxw

I am creating a time sheet that will (hopefully) round hours (calculated from time entered) to the nearest quarter hour.  I have it working in the first row of the table, however, since it is a dynamic table, it copies that number down to the rest of the rows once they are added.  I have limited scripting knowledge, so I'm looking for some help on fixing my code so that each row rounds the correct number.

I'm not sure how to really put that in words, so the link to my form is above.  I'm looking for code for Table1.Row1.hours.

Thanks in advance,

Rose.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Rose,

Here is the form back to use: https://acrobat.com/#d=R1qsHYR1bY6-wGZNElVARg.

The issue was that you were using absolute references to the Hours field: "form1.page1.Table.Table1.Row1.Hours" (or something like that).

When dealing with repeating rows, if you just reference the field name in your script, then each instance of that row will know that the script is referring to the object in its own row: "Hours".

Also in your script you are doing the same calculations several times. I am recommending that you do the calc once and assign it to a variable. From then on you are using the variable.

Hope that helps,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi Rose,

Here is the form back to use: https://acrobat.com/#d=R1qsHYR1bY6-wGZNElVARg.

The issue was that you were using absolute references to the Hours field: "form1.page1.Table.Table1.Row1.Hours" (or something like that).

When dealing with repeating rows, if you just reference the field name in your script, then each instance of that row will know that the script is referring to the object in its own row: "Hours".

Also in your script you are doing the same calculations several times. I am recommending that you do the calc once and assign it to a variable. From then on you are using the variable.

Hope that helps,

Niall