Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Set value if any records match Post Reply Post New Topic
Author Message
idavis
Newbie
Newbie


Joined: 21 Jul 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote idavis Replybullet Topic: Set value if any records match
    Posted: 16 Mar 2017 at 8:45pm
I am really struggling with one element within a report.

I have a series of records and what I am trying to do is set a variable if ANY of the records meet a condition. This issue I have is it works if the most recent record meets the condition but the variable (I guess the clue is in the name) changes if the next record does not meet the condition.

For example

Record 1 No - Date 01/01/17
Record 2 No - Date 04/03/17
Record 3 No - Date 11/02/17
Record 4 Yes - Date 01/03/17
Record 5 No - Date 12/03/17
Record 6 No - Date 09/01/17

The report is grouped so the records above are in a sub group of a supplier.

In this example the report returns the date 09/01/17 and I am trying to get it to return Record 4 Yes - Date 01/03/17.

I use the If record = "No" but this only works if "No" is TRUE for the last record in the cycle. It cycles on to the last record so the final return changes as the condition is no longer met.

Any ideas or advice would be very much appreciated.

Kind regards,

Iain.

Edited by idavis - 16 Mar 2017 at 8:47pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Mar 2017 at 4:41am
Can you explain more what the purpose is for this, if you are doing more calculations from the 'result' and exactly what and where you need to display the content?
IP IP Logged
idavis
Newbie
Newbie


Joined: 21 Jul 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote idavis Replybullet Posted: 20 Mar 2017 at 4:20am
I am trying to use 01/03/17 as the date something starts in a time calculation.

Record 4 Yes - Date 01/03/17

The issue I have is the variable pages through and changed to Record 6 No - Date 09/01/17.

Kind regards,

Iain.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Mar 2017 at 6:49am
set a formula is my answer...a one time flag, so to speak...this may or may not be what you mean.

shared booleanvar isFound;
shared stringvar dateWant;

if {table.column} = someCriteria then (
isFound := true;
dateWant := {table.column2};
);

""

you would need to reset the variables at the correct group level and report on them at the correct group footer.

Hope this gives a road map
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.016 seconds.