A memo field with calculated values

Hello,

i have this pascalscript in a Fastreport with a Header and a MastaData band.
var
  tmpYear, tmpMonth, tmpDay : Word;
  CAfaSatz: TDateTime;
    
begin
  DecodeDate(<frxDBDataset_Main."AD">, tmpYear, tmpMonth, tmpDay);  
  tmpYear := tmpYear + <frxDBDataset_Main."BIS">;  
  CAfaSatz := EncodeDate(tmpYear, tmpMonth, tmpDay);                                               
end.
How can I show the value from CAfaSatz in my Report. The value must be new calculated for every dataset. Where I have make the mistake ?

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 2:44AM
    Very simple, just create a function in the script that returns that value.
    I suggest it returns a string, already formatted with your needs:
    function GetCAfaSatz:string;
    begin
       result := DateToStr(CAfaSatz); /// I don't even know if DateToStr is available, I think it is, but do whatever you want to do to convert it to a string.
    end;
    
    Then in your report, put a tfrxMemoView with this exact value as the text property, without any quotes:
    [GetCAfaSatz]
    
    Cheers

Leave a Comment