Problem with MAX

edited 2:37AM in FastReport 4.0
Hi

I have a database with 6 number and a graph to eachone. But I just want to display the graph (and number) which has the biggest value (on the number)

example I have the numbers 2,4,5,7,3,1 then I want the fourth graph (the one connected to the 7)

I've tried this but it wont work? ideas?

procedure masterdata1onbeforeprint (sender: Tfrxcomponent);
begin
if (<power_U, I_Legend."BORDERQUANTILVALUE">) = (<MAX(<power_U, I_Legend."BORDERQUANTILVALUE">,masterdata1)>)
then masterdata1.visible := true
else masterdata1.visible := false
end;

//Micke

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited July 2009
    You need to identify the maximum value before you enter that masterdata band.
    One way I can think of is that you make an exact copy of your masterdata band, associating with the same dataset, put it above the one that will actually be printed, and calculate the max value there, keeping this 1st band always invisible.

    NewMasterBand.visible := false(do this in the designer)

    then in the script:

    <!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->var lMax : integer;

    OnNewMasterBand(sender...);
    begin
    if lMax < (<power_U, I_Legend."BORDERQUANTILVALUE">) then
    lMax := (<power_U, I_Legend."BORDERQUANTILVALUE">) ;
    end;

    OnExistingMasterBand(sender...);
    begin
    if (<power_U, I_Legend."BORDERQUANTILVALUE">) = lMax
    then masterdata1.visible := true
    else masterdata1.visible := false
    end;

    begin
    lMax := 0;
    end;
    <!--fontc--></span><!--/fontc-->
  • edited 2:37AM
    Thanks :lol:" border="0" alt="laugh.gif" /> works prefectly!" alt="> works prefectly!" />

Leave a Comment