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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppressing First Record on Each Page 1

Status
Not open for further replies.
Feb 9, 2009
77
US
I am going to simplify my problem so its easier to understand...

I have details section a and b. My section A is just a solid horizontal line, my section b is a record. I am trying to suppress the solid line unless its first record on the page and fieldA = "first".

I have created:
@counter (to be placed in details section b)
whileprintingrecords;
shared numbervar counter :=counter +1;

and

@counter_reset (to be placed in page footer)
whileprintingrecords;
shared numbervar counter := 0

When I add those formula,s the counter seems to be working correctly. However when I add the following formula to the suppression x-2 next to details section A, it does not work and the 1st number in the counter on the 2nd page is null.

counter > 1 or fieldA <>"first"

Any idea what I am doing wrong?
 
Why not just use another page header section instead of a detail section?

I think your counter formula should be in detail_a and that your suppression formula should be:

whileprintingrecords;
shared numbervar counter;
not(
counter = 1 and
{table.fieldA} = "First"
)

Not sure why you are using a shared variable (only necessary for passing values to/from subreports)

-LB
 
The reason I am not using a page header is because from my understanding I would not be able to conditionally suppress the page header based on the first details record on the page.

I made the changes you suggested and it still does not work. If the next page starts with details section b, then the counter is null. If details section a counter = 27 on the previous page, there is a reset in the page footer, then details section b counter on the top of the next page is null.
 
I think you should just go into the section expert and format the higher order details section (above detail_a) to "Keep together".

-LB
 
LB, I've tried that as well and have not produced the results I am looking for. Maybe you can think of a better way of doing this then how I am currently going about it. I have no groups. I am trying to box in any record where val1= "cashflow" and have a flag field= 1.

ss1.jpg


So right now I have details section a, with val1 and a details section b with the horizontal gray line. I'm suppressing details b using a formula that checks the previous and current value. It works perfectly unless the beginning of boxed in section starts on a new page (screenshot 3). If that occurs there is no line on top because it has already been shown as the last record on the previous page (screenshot 2). That is why I was attempting to have a details section A with a line, b with val1, and c with a line.

Bottom of page 1:
ss2.jpg


Top of page 2:
ss3.jpg
 
Please provide the actual formula you are using for suppression, not a generic version.

What are the actual field/formulas for "val1" and "flag field"?

In what sections are these fields/formulas placed?

-LB
 
There is just one suppression formula and that is for Details B (which contains the gray horizontal line):

onlastrecord or
((nextisnull({TempBatchData.Val001}) and left(next({TempBatchData.SubName}),1) <> " ")=false) and
(((left({TempBatchData.SubName},1)) = " " and left(next({TempBatchData.SubName}),1) <> " " ) = false)
 
Could you please show a screenshot in design mode so I can see what fields are what? Are the Bolded fields the val field?

Can you specify in words what the rules are for what should be boxed? There might be a cleaner way to do this.

-LB
 
Design Mode (Db is right below Da with a gray line in it):
ss4.jpg


Full Report:
ss5.jpg


Subname is the bold field. I apologize about being vague I am just trying to dumb it down to make the problem easier to solve. Hopefully you can figure out when I start and end the box based on my suppression formula above, but I will try to explain. If the first character in subname is not blank AND Val001 is null then there should be a solid line that appears above that record to start the box. I know when to end the box (a line must appear below this record), when the first character in subname is blank, and the next one is not. Ignore all of the suppressed fields that are mixed in with the details section in design mode, as they are variables being used for coloring. The fields that appear to be overlapping subname in the details section are there for the horizontal lines and each one represent fields in the report that can grow onto the next line.
 
I mocked up a report and the following worked. Add a line to a page header_b section and then format the PH_b section to suppress with the following formula:

not(
{TempBatchData.SubName}[1]<>" " and
isnull({TempBatchData.Val001})
)

The page header section will read the value of the first record on the page.

-LB
 
Wow, that works great. I never realized that the PH reads the first record, something to remember next time. How can I go about suppressing Db if its the last record on a page? For instance in my first group of screen shots, there should not be a line under "Other Liabilities". Thanks again for your help, much appreciated.
 
Instead of your current formula on details_b, try:

not
(
onlastrecord or
(
{TempBatchData.SubName}[1]=" " and
next({TempBatchData.SubName})[1]<>" "
)
)

-LB
 
I don't believe that formula accounts for this portion of my original formula:

((nextisnull({TempBatchData.Val001}) and left(next({TempBatchData.SubName}),1) <> " ")=false)

ss6.jpg


I posted a screenshot of how it looks with your formula in there. The red lines represent lines that do not appear but Db should be showing up. If the next {TempBatchData.SubName})[1]<>" " and the next Val001 is null, then Db should appear.
 
Not sure--try:

not
(
onlastrecord or
(
{TempBatchData.SubName}[1]=" " and
next({TempBatchData.SubName})[1]<>" "
) or
(
{TempBatchData.SubName}[1]<>" " and
next({TempBatchData.SubName})[1]<>" " and
isnull({TempBatchData.Val001})
)
)


-LB
 
I modified the formula and it seems to work:

onlastrecord or
not
(
(
{TempBatchData.SubName}[1]=" " and
next({TempBatchData.SubName})[1]<>" "
) or
(
next({TempBatchData.SubName})[1]<>" " and
nextisnull({TempBatchData.Val001})
)
)

However, the line (Db) is still showing up if its the last record on the page (which is no longer necessary since it is now appearing in Page Header B on the next page). Is there any formula that would act as onlastrecord of page?
 
Personally I think if there should be a line at the top of the next page, there should also be a line at the bottom of the previous page. But I don't see the behavior you describe in my mockup.

So you never want a line at the bottom of a page?

-LB
 
If you look at the screenshot I titled full report, you can see that the line (Db) is attempting to box in a relationship (It starts where subname says "cashflow" and has null val001's and ends after the last line that starts with "rem". Mixed in are other records that should not be boxed in. If you look at the screenshot that says bottom of page1, where the subname says "other liabilities", this should not start or end a relationship. The gray line is appearing below it because the next record is the beginning of a relationship. So in short, I want a line at the bottom of the page if I am ending the relationship, but not if I am starting it. So when a grey line should only appear at the bottom when its the last record and
(
{TempBatchData.SubName}[1]=" " and
next({TempBatchData.SubName})[1]<>" "
)

 
I can't refine this myself as I can't recreate your issue--mine is working. The last record of the page will pick up the value of the first row on the next page when you use the next() function, the same as any other record.

-LB
 
Are you sure yours is working correctly? The reason I ask is because it has to be the perfect situation where a new relationship starts at the very top of the page, where this problem exists. In the report I run which is 60 pages that only happens 1 time. I appreciate your help with this. So as far as you know, there is no way to tell if a record is the last one on a page?
 
You can only tell by counting records per page, and this assumes there is the same number on each page. Might work for you.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top