Nitin Kabra
Nitin Kabra

Reputation: 3236

crystal reports formula field select row with minimum value

i have following data :

Name        Amount
================

Amit         18000
Ajay         19500
Bharat     16100

how do i print the name with lowest amount in the report footer.

i tried the following formula

if {table.amount} = minimum({table.amount}) then
'Lowest Vendor - ' + {table.name}

above formula returns a blank value.

I need this in Crystal Reports not in RDBMS.

Upvotes: 0

Views: 3534

Answers (1)

Siva
Siva

Reputation: 9101

Take a local variable and store the value in that and use the variable in report footer.

    Shared Stringvar a;
Shared Stringvar b;
    a:=
    if {table.amount} = minimum({table.amount}) then
    'Lowest Vendor - ' + {table.name}
else '0';

if a<>'0'
then b:=a;

place this formula beside the amount column.

  1. Create another formula and write below formula and place it in footer

    Shared Stringvar b; b

Upvotes: 1

Related Questions