Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Variables/Loops Post Reply Post New Topic
Author Message
chris
Newbie
Newbie


Joined: 02 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 35
Quote chris Replybullet Topic: Variables/Loops
     Posted: 19 Apr 2010 at 6:44am
Hi all,
 
I have a report which i'm struggling to show the correct date.
 
The data in my details section looks like this - a date field, a type and then a yes/no answer.
 
date A yes        (start)
date B yes
date B yes
date B no          (end)
date A yes        (start)
date B yes
date B no          (end)
date A yes        (start)
date B no          (end)
 
I have a date parameter setup and using this and the data above, i need to be able to show the correct start and end date.
 
Start dates are determined by a type of A and answer of Yes.
End Dates will be a type of B and answer of No. (If this combination does not appear the end date should be blank)
 
What I have so far...
 
Start dates appear to be correctly worked out using variables to show the latest start date prior to the parameter date.
 
End date - this is the problem !! At the moment the end date I have showing is the last record as it meets the criteria (B No). The record i need to show is the first time the criteria is met AFTER the start date which has been worked out above.
 
So how do I stop the variable populating once it has found a value ?? This is where I was thinking a loop might need to be used but I have no experience of using them and therefore any help would be greatly appreciated.
 
Many thanks
 
Chris
 
 
 
 
 
 
 
 
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 20 Apr 2010 at 3:19am
why not set a flag in the formula...a global variable would work, and it could be started/stopped.
 
CR isn't going to let you loop through the data...it basically reads it once (subreports are an exception...kindof).
 
I would try the flag.  Also, is there some other criteria that would allow you to group the data so that it may be easier to see the first and last records?  Then you could build a group on that, but the logic would still be pretty much the same as using a flag of some sort.
 
 
HTH
HTH
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