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 8:23PM
    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

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.