Search code examples
crystal-reportscrystal-reports-2008crystal-reports-2010

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.


Solution

  • 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