on 03-23-2011 12:43 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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
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
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.