Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing a new page 1

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

Here is my situation. I want the report to force a new page once a certain criteria has been met. In this case, the new page is created if the number of records is equal to 26 and the number of records is less than the shared value linenum (Hense, a maximum of 26 lines of detail per page).

Situation A:
recNum = 26 and lineNum = 26
one page prints

Situation B:
recNum = 26 and lineNum = 27
two pages print

Here is my code:
Code:
WhilePrintingRecords;
Shared NumberVar LineNum; 
NumberVar recNum;
(recNum=26 AND recNum<LineNum);

As it stands, I am testing with situation A and two pages print. The second page is essentially blank with the exception of the page header info.

Is my formula incorrect? If so, how do I fix it?

Thanks.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Please show the content of the formulas that establish these values. Do you have a reset formula anywhere? If you are using a subreport, in what section is it located? Also, please clarify whether you have checked "new page after" or ONLY used the conditional formula.

-LB
 
Hi lbass,
Thanks for the response. FYI I am modifying a Sage Accpac report.

Main report:
Page Header:
Code:
// Formula called recNuminit
WhilePrintingRecords;
NumberVar recNum; 
recNum:=0;

Group Header: (The main details appear here)
Code:
// Formula called recNumrun
WhilePrintingRecords;
NumberVar recNum; 
recNum:=recNum+1;

Section Expert:
Detail C - formula set in New Page After:
Code:
WhilePrintingRecords;
Shared NumberVar LineNum; 
NumberVar recNum;
(recNum=26 AND recNum<LineNum);

Subreport (located in page header and is only used to obtain lineNum):
Code:
// Forumla for Subreport details section called @Inv Lines
WhilePrintingRecords;
Shared NumberVar LineNum; 
LineNum:={OEINVH.INVLINES};

All testing shows valid values for both recNum and LineNum.
If you require any additional information, please let me know.




If at first you don't succeed, then sky diving wasn't meant for you!
 
Are you expecting there to be 26 group headers per page? I'm guessing you mean to be counting detail records, in which case your formula {@recnumrun} should be placed in the detail section. Do not check "new page after", just enter the conditional formula. You might need to specify:

evaluateafter {@recnumrun};
whilePrintingRecords;
Shared NumberVar LineNum;
NumberVar recNum;
recNum=26 AND
recNum<LineNum;

-LB
 
Lbass,
As stated this is a Sage Accpac (invoice) report - these reports do not always follow standard report logic. The way the report was created was to have all the details listed in the group header and comments/instructions in the details. The report works without any issue. The group header section is treated like the details section.

I do not have 'new page after' checked.
If I try your suggestion, I receive the following:
"The remaining text does not appear to be part of the formula." after evaluateafter.

After adjusting the report and subreport formatting, it appears as though it is actually working. With 26 detail lines, the report prints on one page and with 27 detail lines, the report prints on two pages. I believe that the LineNum value was being cleared and a value of 0 was being processed due to my suppression of the subreport. I set the font of the subreport to white so that it doesn't appear on the main report.

I thank you for your time and comments you have provided.

If at first you don't succeed, then sky diving wasn't meant for you!
 
It should have been: evaluateafter({@recnumrun});.

Instead of setting the font to white, you can suppress all sections WITHIN the subreport, and the shared variable will still pass.

-LB
 
Thanks for the correction and the additional information.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top