Print Page | Close Window

Wrong data set showing until last page?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22183
Printed Date: 02 May 2024 at 10:57pm


Topic: Wrong data set showing until last page?
Posted By: Doolhoff
Subject: Wrong data set showing until last page?
Date Posted: 21 Dec 2016 at 8:24am
So my boss came to me this morning and handed me a print out of a report. He showed me a circled portion on each page that he said we needed fixed.

So what is happening:

I have a formula:
if {wi_route.wi-r-p-printf} and {wi_route.wi-r-p-printr} = yes Then
     "Two Side Printed"
Else
    If {wi_route.wi-r-p-printf} = yes Then
        "Surface Print"
    Else "Reverse Print"



With this formula I should only get one result showing consistently on all pages. However, I am getting one result on the first 2 or 3 then the correct result on the final page. Can anyone help me to understand this?

Please and thank you in advance.

If you need more info, just let me know



Replies:
Posted By: kevlray
Date Posted: 21 Dec 2016 at 10:25am
I am assuming that  {wi_route.wi-r-p-printf} and {wi_route.wi-r-p-printr} are Boolean otherwise your if statements would fail.  To be consistent you probably should have the first statement as if {wi_route.wi-r-p-printf} = yes and {wi_route.wi-r-p-printr} = yes Then

So I am assuming for any data set that you are using for the report, the values for {wi_route.wi-r-p-printf} and {wi_route.wi-r-p-printr} never change.

If the above statement is true, then the same value should always be returned from the formula.  If {wi_route.wi-r-p-printf} and {wi_route.wi-r-p-printr}ever change in a data set, then the result of the if statement would be based on what values {wi_route.wi-r-p-printf} and {wi_route.wi-r-p-printr}have when the formula is executed.


Posted By: DBlank
Date Posted: 21 Dec 2016 at 10:56am
and to follow up on Kevlray's post, if you are placing your formula in a pager header or page footer it will show the formula result for the data in the first or last row on that page ... as an example of 'when the formula is executed"


Posted By: Doolhoff
Date Posted: 05 Jan 2017 at 5:54am
OK, all that makes sense. So here is my follow up question then.

I have it in the header so it is executing based on the subreports/data on the specified page. Is there a way to force it to always look to one location or to make it only show on the final page?


Posted By: DBlank
Date Posted: 05 Jan 2017 at 5:58am
Consider using a MIN or MAX value for all the records in the report (or possible a group min/max).
I don't know how the data is set and what you want it to do if it is 'mixed' values across the data set.


Posted By: Doolhoff
Date Posted: 05 Jan 2017 at 6:11am
So that would essentially be me telling it to search for only the highest and lowest values and only reporting on those values? That is, if I understand MIN/MAX properly.


Posted By: DBlank
Date Posted: 05 Jan 2017 at 6:57am
That might be one solution but it is hard to to know as I don't know what you want it to print when your data set has different values row to row.
Given the formula you were using to decide between your 3 text results ("Two Side Printed", "Surface Print", "Reverse Print") what should it do if the first row meets the 'two-sided' the second row meets 'surface' the third back to two-sided' the forth row is 'reverse', etc.
Are you grouping data that should always return the same value? Are you only concerned with the first row?
Are you concerned with some sort of aggregate, meaning that all rows must have {wi_route.wi-r-p-printf}='yes' then your condition is met?


Posted By: Doolhoff
Date Posted: 05 Jan 2017 at 8:39am
Yes, I am grouping data that (if it was entered correctly into the database) will have the same value. The issue I am getting is it pulls all the right information but by it being in the header it only gives the correct result on the final page. The first few pages will always return with "Reverse Print" as those pages don't have the proper data in them.

So I am hoping for one of 2 solutions. Either I find a way to suppress it until the final page with the correct result. Or I get all pages to say the correct result.

Sorry if that didn't answer your question...


Posted By: DBlank
Date Posted: 05 Jan 2017 at 8:41am
I am assume you are starting a new page after or before a group change?


Posted By: Doolhoff
Date Posted: 05 Jan 2017 at 8:43am
I'm not sure, I am editing a report someone else created. What would be the easiest way to find that?


Posted By: DBlank
Date Posted: 05 Jan 2017 at 8:46am
section expert, select the group header and footer and see if the new page before or new page after is ticked off or is using a formula

also are people intended to drill into a group to print?
Otherwise since these are mixed groups you would likely have multiple "printing directions" for one print job.


Posted By: Doolhoff
Date Posted: 05 Jan 2017 at 8:54am
No headers or footers have the new page ticked.

What do you mean by "are people intended to drill into a group to print?" No body in the office uses crystal but me. Everyone else access the data through EFI Radius if you're familiar with it.


Posted By: DBlank
Date Posted: 05 Jan 2017 at 11:15am
I am not familiar with EFI.
I am making a number of assumptions here that might be confusing to the problem.
I assumed you were including this text so that when the user went to print the report they would choose the 'correct' way to print it.
I am confused because each group may require a different way to print. To further compound it two groups with different printing requirements might be on the same page.
When I suggested drilling into the report it opens a group into s new report tab and you can print that separately from the larger group which deals with the confusing aspects above.
I still don't think this is entirely what you want but you can set the text using group criteria something like this:

if Minimum({wi_route.wi-r-p-printf},groupfieldhere) = TRUE and Minimum({wi_route.wi-r-p-printr},groupfieldhere) = TRUE Then
     "Two Side Printed"
Else
    If Minimum({wi_route.wi-r-p-printf},groupfieldhere) = TRUE Then
        "Surface Print"
    Else "Reverse Print"


Posted By: DBlank
Date Posted: 05 Jan 2017 at 11:42am
note you would usually want to place that formula field into a group header/footer as it is a 'group result'. If you place it in a page header or footer it will execute for the firs or last group on that page so you have a similar issue as to what you first described. However, I again am not sure why you would want to give opposing printing directions to a single page.


Posted By: Doolhoff
Date Posted: 06 Jan 2017 at 12:06pm
Thank you very much DBlank! I will try your suggestions and hopefully they will work!



Print Page | Close Window