Detaildataonbeforeprint Issue to suppress lines with zero value

I have a very elaborate formula in my Memo226 to calculate a reorder qty on stock:


[iif((Memo202.Value+Memo203.Value+Memo204.Value+Memo208.Value+<Main."OONPURCHASEORDER">-<Main."ORESERVED">)>Memo219.Value,0,iif(Memo196.value>((Memo219.Value+<Main."ORESERVED">)-(Memo202.Value+Memo203.Value+Memo204.Value+Memo208.value+<Main."OONPURCHASEORDER">)),Memo196.Value,((Memo219.Value+<Main."ORESERVED">)-(Memo202.Value+Memo203.Value+Memo204.Value+Memo208.value+<Main."ORESERVED">+<Main."OONPURCHASEORDER">))))


The result of this gives a stock qty to reorder, Values are ether zero or > zero


I am trying to filter out the lines that do not need ordering = ie lines with zero

This is my Procedure


procedure DetailData1OnBeforePrint(Sender: TfrxComponent);

begin

  DetailData1.Visible:=Memo226.value<>0.0


 end;


However I suspect my calculation to get the memo226 is too elaborate for the Detail date visible function to just work..


If I use a known dataset value, (like the <Main."ORESERVED" ) to test the function works to filter out those lines but my Memo226.Value does not work.


I have displayed the values in Memo226 by using the showmessage (Memo226.value); And it displaies then values in my report.. so all seem ok.


But the moment I use the  DetailData1.Visible:=Memo226.value<>0.0 then my report lines do not display at all.


Any suggestions?

Comments

  • Ok seems I've got everyone stumped here.


    let me ask the question differently


    On my report memo200 has the following content [(<Main."OOPTIMUMLEVEL">)] it prints correctly in the report with the values from the database.


    if I use the following: MasterData3.Visible:=(<Main."OOPTIMUMLEVEL">)>100 then my report filters correctly and only then lines where this value is > 100 is printed.


    BUT


    if I use the following: MasterData3.Visible:=Memo200.value >100 then my report DOES NOT filter correctly and NO are printing.


    I need to be able to filter on the Memo200.Value due to the above example where my elaborate formula's result needs to be taken to filter out lines with the onbeforeprint option,


    Any one have any ideas?

  • LurkingKiwiLurkingKiwi Wellington, New Zealand

    Is it possible that Value is a string variant, and the comparison with 100 is being done as string to string, rather than number to number?

    If you assign Memo200.Value to an integer variable first, and then temporarily put that in another memo to print as a string, what do you get?

    Comparing 100 with the integer variable may behave differently, although this is all a guess :-)

  • Hi LurkingKiwi,


    Thank you for your response, and yes that was one of then aspects we looked at, but the solution was in the sequence the different events run on the report.


    We chaged the code to this:


    procedure MasterData3OnBeforePrint(Sender: TfrxComponent);

    begin

     MasterData3.Visible:= true;

    end;

    procedure OnAfterData(Sender: TfrxComponent);

    begin

       MasterData3.Visible:=memo226.value>0;

    end;


    Problem solved,,,something like:- the elaborte calculation is done OnbeforePrint, and the OnAfterdata filters and voila.....we got what we wanted

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.