Help - Search - Members - Calendar
Full Version: A memo field with calculated values
Fast Reports forum > Fast Reports Products > FastReport 4.0
RWarnecke
Hello,

i have this pascalscript in a Fastreport with a Header and a MastaData band.
CODE
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 ?
Anu de Deus
Very simple, just create a function in the script that returns that value.
I suggest it returns a string, already formatted with your needs:

CODE
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
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.