cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a subtotals table in Adobe LiveCycle Designer

0 Kudos

Hi everybody.

I'm having troubles with a template named Customer Invoice (of Application and user management > Business Flexibility > Form Template Maintenance), the case is I modified the template to show a subtotals table that I generate by code (FormCalc language) in Adobe LiveCycle Designer, but the problem is that the code of template just works with some invoices. I don't know what's happening, I hope someone can helps me with this topic.

I'm attaching screenshots I hope it can help you to understand me, in the screenshots I'm marking the table I generated.

My code is (Language FormCalc 😞

var longitud = tblTable.all.length

var aux

var acum = ""

var auxIndex = tblTable.all.length

for i=0 upto longitud - 1 step 1 do

    if(i == 0)then

            Table4.Row1[i].Cell1.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.frmHiddenItem.frmQuantity.decQuantity"))

            Table4.Row1[i].CellMesure.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.frmHiddenItem.frmQuantity.txtQuantityUnit"))

            Table4.Row1[i].Cell2.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.colDescription"))

            Table4.Row1[i].Cell3.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.tblNetValue.rowNetValue.decHiddenNetAmount"))

            Table4.Row1[i].CellCurrency.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.tblNetValue.rowNetValue.txtNetAmountCurrency"))

            Table4.Row1[i].Cell0.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.colProduct"))

        else

            var bandera = 0

            for j=0 upto Table4.Row1.all.length - 1 step 1 do

                if (tblTable[i].rowItem.colProduct.rawValue eq Table4.Row1[j].Cell0.rawValue ) then

                    Table4.Row1[j].Cell3.rawValue =Sum(0.00, Table4.Row1[j].Cell3, tblTable[i].rowItem.tblNetValue.rowNetValue.decHiddenNetAmount)

                    Table4.Row1[j].Cell1.rawValue =Sum(0.00 , Table4.Row1[j].Cell1, tblTable[i].rowItem.frmHiddenItem.frmQuantity.decQuantity)

                    if(xfa.resolveNode(concat("tblTable[",i , "].rowItem.colDescription")) <> "" or xfa.resolveNode(concat("tblTable[",i , "].rowItem.colDescription")) <> null) then

                        Table4.Row1[j].Cell2.rawValue =concat( xfa.resolveNode(concat("tblTable[", i , "].rowItem.colDescription")))

                    endif

                    bandera = 1

                    break

                endif

            endfor

           

            if (bandera == 0) then

                Table4.Row1.instanceManager.addInstance(1).Cell1.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.frmHiddenItem.frmQuantity.decQuantity"))

                Table4.Row1[i].CellMesure.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.frmHiddenItem.frmQuantity.txtQuantityUnit"))

                Table4.Row1[i].Cell2.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.colDescription"))

                Table4.Row1[i].Cell3.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.tblNetValue.rowNetValue.decHiddenNetAmount"))

                Table4.Row1[i].CellCurrency.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.tblNetValue.rowNetValue.txtNetAmountCurrency"))

                Table4.Row1[i].Cell0.rawValue = xfa.resolveNode(concat("tblTable[",i,"].rowItem.colProduct"))

            endif

        endif

endfor

Thank you very much.

Best regards.

Sincerely.

Ismael Lara

Accepted Solutions (0)

Answers (1)

Answers (1)

Florian
Active Contributor
0 Kudos

Hi Ismael,

as far as I can see there might be a mistake in the code itself. Did you check the tablerows you compare here?

I think you might have unexpected values at here:

tblTable[i].rowItem.colProduct.rawValue eq Table4.Row1[j].Cell0.rawValue

This might cause your unexpected result. Your results are never higher than expected, am I right?

~Florian