cancel
Showing results for 
Search instead for 
Did you mean: 

Subtotals in Adobe forms

Former Member
0 Kudos

Hello Experts,

I have created a table using subforms, as I cant fulfill the requirement using table directly.

Inside the subform (Flowed), I have placed all the fields based on the requirement and it is working fine.

Outside the above subform, i have placed a Total field and I used formcalc to display the total. It is also working fine.

Now I dont know how to add sub total in the above mentioned part. I have tried many options, but i am not able to achieve it.

Can someone, pls. suggest a solution to handle subtotal.

Regards,

Imran.

Accepted Solutions (0)

Answers (2)

Answers (2)

prajeshdesai
Contributor
0 Kudos

Try below javascript and run pdf dynamically,


var fields;

var total = 0;

var page = xfa.layout.page(this);

for(var j = 0 ; j < page; j++)

{

     fields = xfa.layout.pageContent(j, "field", 0);

     for (var i=0; i < fields.length; i++)

     {

          if (fields.item(i).name == "ZZPR00_GES")

          {       

               total = total + fields.item(i).rawValue;            

          }

     }

}

this.rawValue = total;

Reference thread: Subtotal on each page for a value | SCN

Hope this helps.

Former Member
0 Kudos

Hello Prajesh,

Thanks for you input. My doubt is not about the logic for calculating.

My doubt is where to create a field in Adobe forms to display subtotal and how to restrict it to display at end of every page.

If I am using directly table, it would be easier. But in my case, I am using Subform to create table as mentioned in the above comment.

Regards,

Imran.

prajeshdesai
Contributor
0 Kudos

Create a field in your sub-form, which you are looping and apply above logic.

Select sub-form content as positioned, and drag it to the bottom of page.

Hope this helps.

sabarna17
Contributor
0 Kudos

Hi,

You can take a Field in Master Page if you want to display the subtotal value positioned in every page.

Otherwise if you want it to be flowed and to repeat the Subtotal field in every page then please check overflow header/ overflow trailer of the body row of the table and add a field inside the subform for that field.

Now calculate the value as Prajesh told before in the corresponding field.

Hope you can achieve the requirement.

Regards,
Sabarna

Former Member
0 Kudos

Hello Sabarna,

The points given by you works for table. But i have subform as shown below.

I want to know where i should insert the subtotal field. If i put inside this subform, subtotal will be repeated for each data item which is wrong. If i put outside the subform, it will appear at last like total which is also wrong.

But i need at end of every page. If i add along with footer, subtotal will appear in last page as well which is also not correct.

Pls. let me know is there any way to achieve this and also pls provide some example screenshots.

Thank you.

Regards,

Imran.

Former Member
0 Kudos

Hi Imran,

Try putting subtotal in the footer and hide it in the last page, have a look at the post below for example script

https://scn.sap.com/thread/1515449

Cheers,

Arshid

Former Member
0 Kudos

Did you mean to display subtotal per page and grand total in the last page, if that's what you want then have a look at

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0aa5d37-8577-2c10-ceb9-d881df423...

Former Member
0 Kudos

Hello Arshid,

Thanks for your inputs.

But the above link explains how subtotal should be added in table.

In my case, i have not created directly table by drag and drop. I have created using subform and gave 'repeat subform for each data item'. Hence, I will not be able to add footer row, as i dont have table at all.

Regards,

Imran.