Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How To Prevent a Page From Displaying?

Avatar

Level 2

have a form with a table on the first page.  If it has more than 7
line items, then it continues to a new master page content area to
display the rest of the line items.  Then it has another separate page
to print at the end.

However, if I have 7 or fewer lines, it still prints my continuation
page.  Is there a way to prevent this page from displaying and from
being included in the page count?

As another option, is there a way I can subtract 1 from the page count
if the number of line items is 7 or less?

I've attached a copy of my hieararchy.  I want Page1 to display.  In it is a table.  If it has more than 7 line items, I have it continue to a content area in LIContPage1.  Page 2 prints last.

However, if there are fewer than 7 line items on Page1, I don't want LIContPage1 to print or be included in the page numbering.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hello Dude,

Check for any field(assume "txtnumber") of the table is there in the page . If no hide the page.

for(var i = 0 ; i < xfa.host.numPages ; i++)

{

var oFields     = xfa.layout.pageContent(i, "field");

z=  oFields.length;

for (nNodeCount = 0; nNodeCount < z; nNodeCount++)

     {  

         if (oFields.item(nNodeCount).name == "txtNumber")

         {

                  this.presence = "Hidden"

         }             

Hope this works!!!

Following fields come under field category(mentioned in script).

Returns all of the following form design objects: Button, Check Box, Date/Time Field,

Drop-down List, Document Signature Field, Image Field, List Box, Numeric Field, Password

Field, Radio Button, and Text Field.

REgards,

Rakesh

View solution in original post

10 Replies

Avatar

Correct answer by
Former Community Member

Hello Dude,

Check for any field(assume "txtnumber") of the table is there in the page . If no hide the page.

for(var i = 0 ; i < xfa.host.numPages ; i++)

{

var oFields     = xfa.layout.pageContent(i, "field");

z=  oFields.length;

for (nNodeCount = 0; nNodeCount < z; nNodeCount++)

     {  

         if (oFields.item(nNodeCount).name == "txtNumber")

         {

                  this.presence = "Hidden"

         }             

Hope this works!!!

Following fields come under field category(mentioned in script).

Returns all of the following form design objects: Button, Check Box, Date/Time Field,

Drop-down List, Document Signature Field, Image Field, List Box, Numeric Field, Password

Field, Radio Button, and Text Field.

REgards,

Rakesh

Avatar

Level 10

Hey, I just responded to you on the LiveCycle Google Group, but I'll include here too just in case!

---

There's a couple of ways to go about it.

Part of it depends on form structure - I have something similar where
a page flows to a second master page but that page doesn't show up
unless it's needed. Maybe check whether you have a Min Count setting
on the second page (Object Palette - Master Page - Restrict Page
Occurence) - I have nothing set there.

You can script the page presence to be hidden, but I'm not sure how to
script it back to being visible if data flows onto it.

[Looks like Rakesh might have the answer to that.]

> As another option, is there a way I can subtract 1 from the page count
> if the number of line items is 7 or less?

You can script specific pages to print or using the preprint and
postprint events you could hide the page and then reveal it again.

You can get the syntax of print() in the help under Scripting/
Scripting Reference/Scripting Methods.

Avatar

Level 2

Well, my work priorities have changed, so I won't get to try this until next week.  I like the ideas here and look forward to trying them.

Thank you very much for the quick replies!

Avatar

Level 2

Please excuse my ignorance, I'm a newbie.  I'd like to try the code that Rakesh suggested.  Where should I put the code (which event for the page)?

If my table is called item and one of the fields is ZCOUNTER, would I replace Rakesh's field txtnumber with ZCOUNTER or item.ZCOUNTER?

Thanks!

Avatar

Former Community Member

you would replace it with just ZCOUNTER. note that javascript is case sensitive though, so make sure that your field's name is in all uppercase.

Billy

Avatar

Level 2

Which event gets the code on the line item continuation page?  It's a master page and I'm doing this within SAP, if that makes a difference.  See the screenprint.

Thank you very much for your help!

Avatar

Former Community Member

Hello Dude,

You can try with the Event layout:ready. You make sure for which field you are checking should be visble n layout all the time.Here if it is Zcounter use it.

bye the bye what do u mean by SAP?

Regards,

Rakesh

Avatar

Level 2

SAP is the Enterprise Resource Planning system we use here.  SAP integrates LiveCycle in the form design.

ZCOUNTER is a field in a table on Page1.  I have a conditional breakpoint that sends the table to a content area on another master page if I have more than 7 line items on the database.

So, the table and field ZCOUNTER are not actually defined on this continuation page.  Therefore, there are no events on the continuation page tied to the table or ZCOUNTER.

If I have 7 or fewer line items on this table, I don't want to print the continuation page that I defined because it won't have any line items.

I had to define a new master page because if I have more than 7 line items, I need to display a footer on page 1 (and only page 1), and then continue the line items on another page.  However, the continuation page has to have its own header.

So, I created a new master page with 2 content areas.  The top content area has the header info.  My conditional breakpoint sends the line items to the content area below the header.

They just can't have this page print if it has no line items.  They can't just throw it away, too, because it gets included in the page count.  For legal reasons, they can't have page 2 of 3 missing.  After the line items are done, there's 1 more page that is printed.

Thanks!!

Avatar

Level 2

I've partially resolved this issue.  I created a global variable and in the conditional breakpoints for the line item table, I move the ZCOUNTER value into the global variable.

If this global variable is < 8, I subtract 1 from the total page count on page 1 and also subtract 1 from the page number and page count on page 3.

The line item continuation page still prints when I don't have more than 7 line items, but it can be thrown away without messing up the page count.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----