Grandtotals in deep structure Array



Hell Gurus,

            I am a SAP Technical Consultant who is struggling to find my way around in Adobe form using JAVA Scripting/FormCalc, I have complex structure (2 level -deep Array within Array) holding data, I have managed to display data, provide sub totals, however, I am finding it difficult to provide Grand Totals.

Table 1

     Table 2 (within Table 1)

      Sub Total (of table 2 for Instance of Table 1)

Grand Total (Sum of all Sub totals of all instances of Table 2)

  1. I have table which has 2 levels, for the second level array, I have been able to provide Subtotals with ease, however, for every entry of 1st level I have to calculate the subtotals and add it grand totals which has to appear at the very end of the form. I have tried the below so far but with out any success:-
  2. Adding the the subtotal value to an external table row field and using that value in Grand Totals, so in the calculate event of field in footer row of the table for sub total field of Table 2, I wrote " $.rawValue = sum(EMP_DETAILS.DATA[*].FIELD[*]);", this gave me the sub totals., this was the easy part.
  3. Then I tried to write this value to an external field using below syntax "$.parent.parent.parent.parent.parent.parent.Emp_Payroll_Detail.Heading.BNK_TRNSFR.rawValue = $.rawValue", so far so good. I could see that value getting over written by instance of the table that gets created, if would the hold the value of the last instance.
  4. The last bit of code is giving me a problem, it gives me junk values not only in external field, but now the subtotals are also showing wrong calculations, the entire code is as below

$.rawValue = sum(EMP_DETAILS.DATA[*].FIELD[*])

"var bank = $.parent.parent.parent.parent.parent.parent.Emp_Payroll_Detail.Heading.BNK_TRNSFR.rawValue

if (bank == " ") then

$.parent.parent.parent.parent.parent.parent.Emp_Payroll_Detail.Heading.BNK_TRNSFR.rawValue = $.rawValue


$.parent.parent.parent.parent.parent.parent.Emp_Payroll_Detail.Heading.BNK_TRNSFR.rawValue = bank + $.rawValue


In the above code I am adding the previous value and new value and writing it back to field, however, this for some reason doesn't seem to work.

How can I capture the values of each instance of Subtotal and write it in Grand total?

Accepted Solutions (0)

Answers (0)