Topic: Fast Report Ordinal Number of day of the Date

I'm using [Now #dd] to reflect current day in number.
I want to add an ordinal suffix to it like 1st, 2nd, 3rd to 31st of the month.

How should I do it? Thanks!

Re: Fast Report Ordinal Number of day of the Date

Anyone? hmm Pleasee sad

Re: Fast Report Ordinal Number of day of the Date

but in a report?

Domebil

Re: Fast Report Ordinal Number of day of the Date

You should create an event OnAfterData for the memo

example:

procedure Memo12OnAfterData(Sender: TfrxComponent);
var
       i: integer;
       s: string;                              
begin
       s := Memo12.Text;
       s := ReplaceStr(s, #13#10, '');                                                                     
       if ValidInt(s) then
       begin
           i:= StrToInt(s);
           if (i=1) or (i=21) or (i=31) then Memo12.Text := s + 'st'
           else if (i=2) or (i=22) then Memo12.Text := s + 'nd'
           else if (i=3) or (i=23) then Memo12.Text := s + 'rd'
           else if ((i>=4) and (i<=20)) or ((i>=24) and (i<=30)) then Memo12.Text := s + 'th';                                                                              
       end;
end;
Dmitry.

Re: Fast Report Ordinal Number of day of the Date

domebil wrote:

but in a report?

Yes. On FastReport.

Re: Fast Report Ordinal Number of day of the Date

DriveSoft wrote:

You should create an event OnAfterData for the memo

example:

procedure Memo12OnAfterData(Sender: TfrxComponent);
var
       i: integer;
       s: string;                              
begin
       s := Memo12.Text;
       s := ReplaceStr(s, #13#10, '');                                                                     
       if ValidInt(s) then
       begin
           i:= StrToInt(s);
           if (i=1) or (i=21) or (i=31) then Memo12.Text := s + 'st'
           else if (i=2) or (i=22) then Memo12.Text := s + 'nd'
           else if (i=3) or (i=23) then Memo12.Text := s + 'rd'
           else if ((i>=4) and (i<=20)) or ((i>=24) and (i<=30)) then Memo12.Text := s + 'th';                                                                              
       end;
end;

Thank you. I think I can't use this since I'm just pulling day of the date using [Now] (Pulled from expression editor of Fast Report Designer)

Re: Fast Report Ordinal Number of day of the Date

Why you can't?
Just attach your project, I'll check it.

Dmitry.

Re: Fast Report Ordinal Number of day of the Date

Oww.. got it working though. Haha my bad. Thanks again Dmitry!

More power!