Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Record selection IF Statement Post Reply Post New Topic
Author Message
matt1361
Newbie
Newbie


Joined: 07 Nov 2007
Location: United States
Online Status: Offline
Posts: 17
Quote matt1361 Replybullet Topic: Record selection IF Statement
     Posted: 09 Dec 2009 at 4:13pm
HI,
 
I am trying to use the following formula in a record selection.
 
(IF {TABLE.DOCUMENT_TYPE} = 'REBILL' AND
{TABLE.DOCUMENT_TYPE} = 'INVOICE' THEN
{TABLE.DOCUMENT_TYPE} = 'REBILL' ELSE
{TABLE.DOCUMENT_TYPE} = 'INVOICE')
 
When there are multiple records with the same invoice number but a different document type, I would like it to pull the REBILL document type instead.
 
With the IF statment I have written, only the document type of INVOICE is pulled when a REBILL is present. 
 
Can anyone see what I am doing incorrectly?
 
Thanks,
Matt
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Dec 2009 at 6:49am
record selection is kind of a pass fail on one row of data. Call it a filter. As such, a record type cannot be both Rebill and Invoice, and so always falls to the else. Only types of Invoice are valid, so that is all that is displayed.
 
Depending on the report layout, you want to display what the document type is.  This is best done in a report footer, as you will have read all of the detail rows and can determine if the type is a rebill or an invoice. If you need to do this in the group header, you will need to use a subreport, which will impact the performance of the report.
 
HTH
IP IP Logged
matt1361
Newbie
Newbie


Joined: 07 Nov 2007
Location: United States
Online Status: Offline
Posts: 17
Quote matt1361 Replybullet Posted: 10 Dec 2009 at 7:40am
Makes sense. 
 
Thank You.
IP IP Logged
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