Friday, March 23, 2012

Formatting problem

Hi there,

new to the forum, I have a question for you, hoping for your kind help.
We are using CR to porting a lot of Access report under .Net (VS 2003). We have encountered a lot of problem, and guessed we cannot simply copy-and-paste.

In order to manage developing phase better, and to obtain a cross-application use of that report, we have choosen to late-bind the report on the datasource, that is: the report is designed having just a .ttx (fields definition only) as database. Later at runtime we will provide a strong-typed dataset as datasource. This chain works better, but we are suffering some problems formatting Date, which came from Oracle as DateTime (this is the .Net native class too).

Altrough we have specified a DATE or DATETIME in .ttx file, setting the desidered format in the .rpt, data take the default format which include time (that we wish to hide). Thought is possible to size the field in appropriate manner, so the time ciphers will be hide, it is unclear what is happening under the hood and why format specification seems to be ignored.

Whe have tried to workaround the issue formatting server-side the value, and even assuring the value reach the report as String: in this case it is obvious the format issue is skipped, but we cannot group-by nor order-by date (in fact it is not a Date, it is a String and is ordered and grouped in its proper fashion).
Our desired format is dd/mm/yyyy.

Any suggestion will be greatly appreciated, really gratefully.

Best Reguards,
MarcoA little update,

it seems that value declared in the .rpt as DateTime will be formatted accordingly with format specification;
and values declared in the .rpt as Date will be formatted accordingly to thread default (which include time, and needs to include it).

Pleaser remark the type declaration in .ttx is the same (DATE). Do anyone know a better valid definition? Do anyone know how to force the report-level type, or force the fomat on the simple Date value?

I can add that seems (but is not demonstrated) that report entirelly created with CR.Net has Date as report-lever-type, where report originally created with CR 9 and opened and changed with CT.Net has DateTime as report-level-type. Odd, isn't it?

A word of clarity is strongly rewarded, for the good of my mind :)
Please, do not leave me alone with this trouble, if you can help soon.

Again best Reguards,

Marco|||I found the solution of my own,

it is once again the case who can lead to bad mistakes. If you have an "old" ttx, your DateTime field is marked as "Date" or "DATE" or "DATETIME", making no difference.
With the .Net version if you have a field marked as "Date" or "DATE" or "DATETIME" it will be recognized as a Date Field.
If you have a field marked as DateTime instead, it will be recognized as DateTime which is my desiderd type.

This DateTime field will match the type in the DataSet field, so the format will be applyied correctly, but if you have declared a Date field and at runtime it become DateTime, it will take the default format, because you have specified a Date format, not a DateTime one.

No comments:

Post a Comment