Problem with MAX

edited 6:11PM 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 6:11PM
    Thanks :lol:" border="0" alt="laugh.gif" /> works prefectly!" alt="> works prefectly!" />

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.