cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove item header on the last page

Former Member
0 Kudos

Hi,

We have an adobe form where, on the last page a BIG footer gets displayed.

Now if the number of line items are not enough, they wont go till the last page, but the last would still be printed with no line items, just to accomodate the huge footer that we want to be displayed only on the last page.

Now in doing this, we want that if there are no line items on the last page, the item header should not be displayed. We are not sure how do we do this.

The same is accomplished in SAP Script, and there they are using WRITE_FORM with type DELETE. So anything that prints after that even on a new page, the item header wont get printed.

Please suggest how do we do this in Adobe Forms.

Thanks,

Tirth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pandya,

do you want to hide the header on last page at all times..or do you want to check if there are no rows in the table in last page then hide the header...?

also is that a table you are referring to with header row, data row & footer rows...?

based on this script differs,

Cheers,

Sai

Former Member
0 Kudos

Hi Sai,

Yes, we want the header to be hidden on the last page only when there are no rows coming on the last page.

We have only one header for the item table(which is the item header). there are not footers for that table.

Thanks,

Tirth

Former Member
0 Kudos

Hi Mate,

there is a contradiction then.

in table header rows definition, we specify show header in subsequent pages, then the header appears only if there are items displayed on that page. in your case the table header shouldn't be displayed then please check why its comming out there...?

well in any case if you want the script it would be like below on layout ready event of the header row.



// run the below script in last page
if(xfa.layout.page(this) == xfa.layout.pageCount()){
var pageSFList = xfa.layout.pageContent(xfa.layout.page(this) - 1, "subform", false);
var pageTotal = 0;
// for each subform named <Item>, which is the data row of the table
for (var i = 0; i < pageSFList.length; i++)
{
	var sf = pageSFList.item(i);

        if(sf.name == "headerrow"){ // if header row is found then chec is data row is visible and set its presence accordingly
           if(sf.parent.item.presence == "hidden"){
               sf.presence = "hidden";
          }
       }

	if (sf.name == "Item") // if data row itself is found set its presence accordingly
	  sf.parent.headerrow.presence = "visible";
}
}

you might need to tweak the code according to your element names.

hope this helps,

Cheers,

Sai

Former Member
0 Kudos

Hi Sai,

That was quite an informative post by you.

Let me add something, We have the item header separately defined in the master page. The item details are in a different subform defined in the Design view.

We are not directly binding a table to display the items. We are doing this because the item details are quite complex and they are not exactly the same as table header columns. There are a lot of texts and delivery schedule info floating for every line item.

So, considering the above situation, should we still go ahead with the code that you have suggested? I believe I should've mentioned this earlier. Sincere apologies incase the solution has to take a new direction altogather.

Please advise.

Thanks,

Tirth

Former Member
0 Kudos

Hi Pandya,

let me put it here what I have understood.

you have a requirement of displaying internal table data.

due to some reasons you maintained coulmn headers in master page.

and the actual rows in body page (rows may be in some nested subform format)

now the requirement is if there is now row displayed in a body page, the the coulmn header in the master page to be hidden.

right..?

the script has to be written in layout ready event.

since the master page script runs after body page, if you place this code on master page it should work. else try putting it in body page.

if you can send me your form, i can give it a try.

Cheers,

Sai

Former Member
0 Kudos

Hi Sai,

Yes you spotted it exactly right.

We tried putting the Java Script in the LayoutReady event of the item_header subform.

I'd like to confirm one more thing, in the following code, we have raplaced "subform" with the subform which has the line items fields which is in the design view. Hope we are not doing something wrong.

var pageSFList = xfa.layout.pageContent(xfa.layout.page(this) - 1, "subform", false);

We are somehow not able to hide the item_header. We also tried to see what is the value of pageSFList.length. But again, to our surprise xfa.host.messageBox("") is also not working.

we tried binding the pageSFList.length value to a different field in layoutReady, but even that didnt show up anything.

Please suggest if we are missing anything on the implementation.

Thanks,

Tirth

Former Member
0 Kudos

Hi Mate,

I have built a sample form exactly to your requirement.

if you can send me a test mail to my id (find it in my business card here), i will reply you with an attachment.

Cheers,

Sai

Former Member
0 Kudos

Thanks Sai,

Have sent you the test email.

Please send across the test form that you have created.

Many Thanks,

Tirth

Former Member
0 Kudos

Replied you with the attachment.

Former Member
0 Kudos

True genius!!

The JavaScript did the trick. I wrote the same JS worngly last time. The example form that you have created is very apt.

It really bought quite a lot of learning about the flow of execution and use of JS too.

Great Thanks,

Tirth

Former Member
0 Kudos

Cheers mate,

Good to hear that you got the solution.

below is my code for anybody looking for similar requirement.


if(xfa.layout.page(this) == xfa.layout.pageCount()){
	var flag = "0";
	var pageSFList = xfa.layout.pageContent(xfa.layout.page(this) - 1, "subform", false);
	for (var i = 0; i < pageSFList.length; i++)
	{
		var sf = pageSFList.item(i);
		if(sf.name == "Row_Item")
			flag = "1";
    }
    if(flag == "0"){
		this.presence = "hidden";
    } 
}

@ Moderators: please advice how can I attach the sample file to this thread so that it can be useful for others in future...?

Regards,

Sai

Former Member
0 Kudos

Hi Krishna,

Please, could you help me, I'm with this issue,

I have tried to apply your code in the subform of my header line (it's within master page) but, Im not able to make it run, There is a syntax error.

I have named all object as bellow.

if(xfa.layout.page(this) == xfa.layout.pageCount()){

     var flag = "0";

     var pageSFList = xfa.layout.pageContent(xfa.layout.page(this) - 1, "MY_HEADER_SUBFORM", false);

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

     {

          var sf = pageSFList.item(i);

          if(sf.name == "MY_ITEM_SSUBFORM")

               flag = "1";

    }

    if(flag == "0"){

          this.presence = "hidden";

    }

}

Please, am I forgetting something?

Kind regards.

Vinicius Ostan

Answers (0)