Discussion:
Date field not appearing in some reports
(too old to reply)
HBB
2004-11-05 22:00:05 UTC
Permalink
Hello:

I have a series of reports that include in their heading two dates (
StartDate and EndDate ) taken from a table that has only one record and two
fields of date format.

The fields are always defined in the reports as:

First(:PRIV:H_DATES.StartDate)
First(:PRIV:H_DATES.EndDate)

In some reports the dates display Ok,

In others it just displays 00/00/0000, when the table has the correct
value.

I have noticed that if I put a second record in the table, the first record
display Ok, but It is not what I want to do.

Any ideas ?

Btw, where is documented the way to embed some OPAL code in reports ?

Thanks a lot, and have a nice day.

Horacio
Anders Jonsson
2004-11-05 22:39:25 UTC
Permalink
I assume you wish to have a report that has a heading like
"Sales from 7/8/2003 to 11/11/2004" and that the report is triggered from
code.

In that case you could write code like this:

var
tc tCursor
stHeading string
r report
endvar

tc.open(":PRIV:H_DATES")

stHeading="Sales from "+string(tc.StartDate)+" to "+string(tc.EndDate)
tc.close()

WriteEnvironmentString("HEADING",stHeading)

r.open("MyReport")

and then in the report you have a calculated field that is defined as

ReadEnvironmentString("HEADING")

HTH

Anders Jonsson
HBB
2004-11-05 22:31:12 UTC
Permalink
Thanks, Anders

I suppose the scope of ReadEnvironmentString and WriteEnvironmentString is
the whole Paradox session, right ?

This is because I dont trigger the reports from the code, really the code
that calculates dates is finished when the reports are triggered, but I
suppose it will work

I try and let you know.

Thanks again and nice week end.

Horacio
Robert Wiltshire
2004-11-06 03:54:34 UTC
Permalink
Horacio,

How did you place the fields on your report ?
Did you just put single fields on the report ?

When I did it that way,
I had problems sometimes, just like you.

If I put a MRO , a multiple record object, in the report,
and then put my fields on that mro,
then I had no problems.

Try it and report back if that helps or not.

Good luck
Robert Wiltshire
Anders Jonsson
2004-11-06 10:56:10 UTC
Permalink
I suppose the scope of ReadEnvironmentString and WriteEnvironmentString is
the whole Paradox session, right ?
Yes.
This is because I dont trigger the reports from the code, really the code
that calculates dates is finished when the reports are triggered, but I
suppose it will work
I try and let you know.
An alternative could be to use WriteProfileString and ReadProfileString
to/from an ini-file in your priv-directory, then the information will be
saved even if they end the session (see the helpfiles for
WriteProfileString).

However, I think that your initial approach _should_ work, but as usual
there are many different ways in Paradox to achieve the result you want.

Anders Jonsson
HBB
2004-11-06 15:25:51 UTC
Permalink
Thanks again Anders and Robert.

I tried both ways and everything worked Ok.

Encapsulating dates in the MRO object makes dates appear in the same
reports ( same datamodel ) that failed before.

As a plus, the MRO object is practical to copy from a working report and
paste into failed ones.

Have a nice week - end.

Horacio

Loading...