Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: zentechinc Post Reply Post New Topic
Author Message
zentechinc
Newbie
Newbie


Joined: 07 Dec 2010
Online Status: Offline
Posts: 4
Quote zentechinc Replybullet Topic: zentechinc
    Posted: 15 Mar 2011 at 12:57pm
Okay, so i am trying to compare two different fields related by a customer number but differentiated by another field. The layout looks something like this:

cust_no, consump, mxu_id
0000001,      13,     LF
0000002,      10,     LF
0000003,     117,     HF
0000004,      43,     LF
0000004,      60,     HF
0000005,      91,     LF
0000005,      70,     HF

Ideally, i would like the report to return only those values where consumption (consump) is identified as being High Flow (HF) AND where the high flow consumption is greater than the Low Flow Consumption (LF). In short, it should only return customer number 0000004.

Is there any way to do this?

I have a selection query that works great for listing anything with HF and LF since mxu_id can contain quite a few other things.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 16 Mar 2011 at 3:33am
well, I would try grouping by cust_no, and sort by mxu_id.  Then I would suppress the group/details if the count for the group was 1, or if Next(consump) > consump.
 
at the very least, it's a start
IP IP Logged
zentechinc
Newbie
Newbie


Joined: 07 Dec 2010
Online Status: Offline
Posts: 4
Quote zentechinc Replybullet Posted: 16 Mar 2011 at 6:11am
Good advice. Im not in the office today but i will implement it tomorrow.

The problem with the Next Consump > consump is that the High Flow does not always come after Low Flow so i cannot rely on that to consistently output my desired data.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Mar 2011 at 6:32am
to deal with ordering issues i would try a using a couple of formulas, grouping and then the select expert with a group condition
formula1 "LF_formula"
if mxu_id = 'LF' then consump else 0
formula 2 "HF_formula"
if mxu_id = 'HF' then consump else 0
group on cust_no
use the select expert in group selection as
distinctcount(mxu_id,cust_id)=2
and
maximum(@HF_formula,cust_id)>maximum(@LF_formula,cust_id)
IP IP Logged
zentechinc
Newbie
Newbie


Joined: 07 Dec 2010
Online Status: Offline
Posts: 4
Quote zentechinc Replybullet Posted: 18 Mar 2011 at 9:21am
...
DBlank, I love you.
Nah, JK. This is the first time ive had a chance to look at the issue in the past few days but DBlank's post looks promising. Thank you.
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.000 seconds.