Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Suppressing Out of Sequence Records Post Reply Post New Topic
Author Message
zeemonee
Newbie
Newbie


Joined: 19 Nov 2008
Location: United States
Online Status: Offline
Posts: 2
Quote zeemonee Replybullet Topic: Suppressing Out of Sequence Records
    Posted: 19 Nov 2008 at 11:55am
Hello,
 
I'm having some difficulty in the syntax and logic around suppressing records out of sequence.
 
Sample Data
row1, Status1, Date
row2, Status3, Date
row3, Status2, Date
row4, Status2, Date
row5, Status3, Date
row6, Status2, Date
 
Requirements
1. Do not suppress row1, no matter what status it is.
2. Do not suppress the first occurance of Status2.
3. Calculation on Date, and must be sorted in order by date which are unique to the record.
 
Below is the code that I've been working with in the Suppress Formula, in the detail section.
 
*************** Code *****************
dim blSuppress as boolean
 
blSuppress = false
 
if  recordnumber() = 1 then
    blSuppress = false
else
    if  {Status} = "Status2" then
        if ??? need to know if this is the first occurance of this status ??? then
             blSuppress = false
        else
             blSuppress = true
        end if
    else
        blSuppress = true
    end if
end if
 
formula = blSuppress
*************************************
 
Hope someone can help, I may be missing a simple function that I need or my logic is not quite right.
 
TIA,
 
Zee
IP IP Logged
zeemonee
Newbie
Newbie


Joined: 19 Nov 2008
Location: United States
Online Status: Offline
Posts: 2
Quote zeemonee Replybullet Posted: 19 Nov 2008 at 1:53pm
I went ahead and split the logic into two subreports.
 
1st subreport - Pulls the records and suppresses all rows except the first.
2nd subreport - Pulls records with Status2, and suppresses all rows except the first.
 
This seems to be a better design, but if you have any input please post.  It would be nice to see how other people would have resolved this issue.
 
Thanks!
Zee
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Nov 2008 at 4:25pm

Here's what I would do: Create a global string and append every status to it as it gets printed. Then, prior to printing a record, check to see if that status is already in the string. If so, set blSuppress to True. If not, set blSuppress to False and add the status to the end of the string (comma separated). That should work pretty well and not require any subreports.

I have tons of tips and tricks in my Crystal Reports Encyclopedia books. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.