Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: CONDITIONAL LIST challenge Post Reply Post New Topic
Author Message
aaron80126
Newbie
Newbie
Avatar

Joined: 07 Mar 2016
Online Status: Offline
Posts: 14
Quote aaron80126 Replybullet Topic: CONDITIONAL LIST challenge
    Posted: 08 Mar 2016 at 7:04am
I need to produce a conditional list report of grouped WIDGETS.
I want ONLY the list results that contain at least one instance of JOB.STATUS = 'open'.
This means that WIDGETS with a JOB.STATUS = 'closed' could be included in the results, but there would never be a list of WIDGETS with only a JOB.STATUS = 'closed' by itself.
I've tried unsuccessfully applying filters to a 'widgets' group.    

Example of desired group result:

WIDGET 5 . . . OPEN . . . JOB 200
WIDGET 5 . . . CLOSED . . JOB 190
WIDGET 5 . . . CLOSED . . JOB 180

WIDGET 9 . . . OPEN . . . JOB 550
WIDGET 9 . . . CLOSED . . JOB 500

WIDGET 15 . . . OPEN . . .JOB 910
WIDGET 15 . . . CLOSED . .JOB 890
WIDGET 15 . . . CLOSED . .JOB 805
WIDGET 15 . . . OPEN . . .JOB 770

Example of UNDESIRED group result:

WIDGET 20 . . . CLOSED . . JOB 1200
WIDGET 20 . . . CLOSED . . JOB 1190
WIDGET 20 . . . CLOSED . . JOB 1180
WIDGET 20 . . . CLOSED . . JOB 1177
WIDGET 20 . . . CLOSED . . JOB 1170

How would the Crystal syntax formula look in order to achieve this? Or please guide me to the right instruction resource.

FYI, I am barely an intermediate user of Crystal Reports, so I won't be surprised if this solution is actually straightforward.
Thanks in advance for your help!

Edited by aaron80126 - 08 Mar 2016 at 9:42am
aaron80126
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2016 at 9:58am
if you can you can you could adjust it as a command with an exists clause or similar.
If you need a crystal solution you can do a group max on the field and then do a group select where that group max ='Open'
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 24 Mar 2016 at 1:58am

Follow these steps:

Group by Widget

Create a fórmula named "IsOpen" or choose the name you like. Use this code:

If {JOB.STATUS} = "OPEN" Then
    formula = 1
Else
    formula = 0
End If

Create a summary field choosing IsOpen as field to resume, and SUM as the operation. Put it in the Widget group.

Create a Group Selection formula (not Record Selection). Choose the summary field created in the previous step and set the condition "Is greater than zero".

Hide the fields you don't want to see.

You've done

(Used CR 2013)
IP IP Logged
aaron80126
Newbie
Newbie
Avatar

Joined: 07 Mar 2016
Online Status: Offline
Posts: 14
Quote aaron80126 Replybullet Posted: 24 Mar 2016 at 8:06am
Thank you, Valert16. I get the logic to your solution, but when I run the formula checker for . . .

If {JOB.STATUS} = "OPEN" Then
    formula = 1
Else
    formula = 0
End If

. . . I get the message on the highlighted word "formula" that reads: "A number, currency amount, boolean, date, time date-time, or string is expected here." So I'm missing something probably obvious here.

I'm using CR XI.


Edited by aaron80126 - 24 Mar 2016 at 8:07am
aaron80126
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Mar 2016 at 8:15am
just so you understand, the solution I gave you is the same thing, it just omits the extra overhead of the formula and the sum of that formula.
If you wish to use the extra steps of the sum of a value, Valert16 gave you an answer Basic Syntax. YOu can switch your formula to use that or change it to

If {JOB.STATUS} = "OPEN" Then 1 else 0
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 24 Mar 2016 at 8:27am
As noted by DBlank, my formula uses Basic Syntax. If you use Crystal syntax, change to Basic. One good thing about Crystal is that you can have formulas writen in both syntaxes in the same report.
IP IP Logged
aaron80126
Newbie
Newbie
Avatar

Joined: 07 Mar 2016
Online Status: Offline
Posts: 14
Quote aaron80126 Replybullet Posted: 29 Mar 2016 at 7:11am
Thank you, DBlank & Valert16! Your solution(s) worked just as I needed. I appreciate your willingness to help out.
aaron80126
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.