Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

need help: QReport - Expressions

163 views
Skip to first unread message

Christoph Wolf

unread,
Nov 16, 1998, 3:00:00 AM11/16/98
to
need:
QRGroup based on Expression like MONTH(any TDateTime) or
FormatDateTime('mm', any TDateTime)
problem: there is no way to make an expression with extracting parts of
dates

does anybody know a solution?


James

unread,
Nov 17, 1998, 3:00:00 AM11/17/98
to
By absolute coincidence I am trying to do exactly the same thing. Have
emailed QUSoft who simply replied :-

"see decodedate" - yeah thanks, except that don't work in the expression
property.

I have emailed asking for help in getting to the TQRGroup.Expression
property and are awaiting a reply. At least you could alter the copy(date,
x, x) statement in expression at run time to suit international date
formarts.

As soon as I hear from the "professionals" in norway, i will post here.

Christoph Wolf wrote in message <3650ADF3...@edu.uni-klu.ac.at>...

Christoph Wolf

unread,
Nov 17, 1998, 3:00:00 AM11/17/98
to
Well, i found something in a FAQ list:

They say, i have to create a calculated field in the table of the
dataset-property containig my calculations needed e.g.: mm/yyyy.

This works, but this is a workaround and no solution!

André Mens

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
You can create a date function wich then expands the functions of the
expression evaluator.

--
Greatings André Mens author of QReport Artist.
EMail an...@mensand.demon.nl
Homepage http://mensand.demon.nl

QReport Artist the QuickReport EndUser report Designer with Delphi like IDE.
Christoph Wolf heeft geschreven in bericht
<365182C6...@edu.uni-klu.ac.at>...

Christoph Wolf

unread,
Nov 19, 1998, 3:00:00 AM11/19/98
to
Thanks André ;)

Although it was a terrible search through not existing help i can present a
quick solution for this problem. You can add additional functions to the
Expression editor just as André said.

Here is my example (not best coding, indeed, but it shows how it works):

A Expression Function for simulating
FormatDateTime(Format:string;dat: TDateTime) :string

unit datetime;


interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Quickrpt, QRCtrls, QRprntr;

type TQREvFormatDateTimeFunction = class(TQREvElementFunction)
public
function Calculate : TQREvResult; override;
end;

procedure Register;
implementation

function TQREvFormatDateTimeFunction.Calculate : TQREvResult;
begin
if ArgList.Count = 2 then
begin
If (self.Argument(0).Kind = resString) and
(self.Argument(0).Kind = resString) Then
begin
try
StrToDateTime(Argument(1).StrResult);
Result.Kind := resString;
Result.StrResult := FormatDateTime(Argument(0).StrResult,
StrToDateTime(Argument(1).StrResult));
except
Result.Kind := resError;
end;
end
else
Result.Kind := resError;
end else
Result.Kind := resError;
end;

procedure Register;
begin

QrPrntr.RegisterQRFunction(TQREvFormatDateTimeFunction,'test','Datumsroutinen','xoffi','');

end;
begin
end.

In delphi 3 just follow the steps for installing a component to link the
datetime.dcu to a
xxx.dpl package ;)

Greetings,

christoph

0 new messages