# finding minimum value <> 0

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
LVL 1
###### Who is Participating?

x

Commented:
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

Commented:
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

Author Commented:
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

Thanks
0

Author Commented:
Thanks alot, i've been banging my head against the keyboard for awhile on this one.
0

Commented:
0

Author Commented:
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

Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.