Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

finding minimum value <> 0

Posted on 2004-08-14
7
Medium Priority
?
403 Views
Last Modified: 2011-08-18
Im sure this is a easy one but i cannot figure it out....

how do I find the minimum value of a field not equal to zero?

Thanks
0
Comment
Question by:cwagner17
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 11800922
You can't use the min() summary because this will return the minimum whether or not it's equal to zero.  Instead you'll have to create a couple of formulas.

In the report header create this formula:

     shared numberVar SmallestFound := 99999;


In the details section create this formula:

     if {table.field} > 0 and {table.field} < shared numberVar SmallestFound then
          shared numberVar SmallestFound := {table.field};

Finally wherever you want to know the smallest value (report footer?) simply create this formula:

     shared numberVar SmallestFound;


HTH

frodoman
0
 
LVL 1

Author Comment

by:cwagner17
ID: 11801063
ok that helped a little bit....

for every incident I track which trucks responded. I want to find out which truck responded first based on time. the time is stored as a number. When i use the above formula it finds all the vehicles and adds the time together. when i view it in the details section it shows each truck.

I don't know why it is showing all of them.

i created a group incapps.idnumber

my tables are as follows:

in5basic.incidentnumber
incapps.alarmtime
incapps.enroutetime
they are linked by in5basic.idnumber--->incapps.reportidnumber

Thanks
0
 
LVL 42

Accepted Solution

by:
frodoman earned 200 total points
ID: 11802609
So what you want is the lowest value within each group, right?  In that case do this:

In the report header create this formula:

     shared numberVar SmallestFound;

In the group header create this formula (just use a value larger than anything you'll see in your report):

     shared numberVar SmallestFound := 99999;

In the details section create this formula:

     if {table.field} > 0 and {table.field} < shared numberVar SmallestFound then shared numberVar SmallestFound := {table.field};

In the group footer put this formula:

    shared numberVar SmallestFound;


You can suppress any of these formula so they aren't visible on the report.

HTH

frodoman
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 1

Author Comment

by:cwagner17
ID: 11802686
Thanks alot, i've been banging my head against the keyboard for awhile on this one.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 11805000
Glad I could help.
0
 
LVL 1

Author Comment

by:cwagner17
ID: 11817255
one more thing......

how do i have it ignore the field if there is nothing in it. it seems to be causing a problem if every one doesn't have a time in it.

thanks
0
 
LVL 42

Expert Comment

by:frodoman
ID: 11820055
check for isNull({field}) first...

if not isNull({table.field}) then
(
if {table.field} > 0 and {table.field} < shared numberVar SmallestFound then shared numberVar SmallestFound := {table.field};
)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question