Page 1 of 1

Date Field does not show string anymore

Posted: Thu May 16, 2019 11:04 am
by Scotty2
In many reports I have for example a field formatted as „Date“. The expression for this field is for example
{Format("{0:dd.MM.yyyy}", DateStart)} - {Format("{0:dd.MM.yyyy}", DateEnd)}

In former versions of Stimulsoft Report it was interpreted as string if there was an expression other than a date.
In the version 2019.2.3.0 only the first date would be displayed in this field. The rest of this string will not be displayed.

There is an easy way to solve this problem by using format „General“ instead of “Date”.
But there are already many decentralized reports.

Is it possible to redo this behaviour, if there is more content then one date in the field?
If it is not possible, can you provide a method how I could locate such fields before rendering the report and change the field format from “Date” to “General” in the code of the report.

Please find attached an example report.

Thanks

Re: Date Field does not show string anymore

Posted: Fri May 17, 2019 10:54 pm
by Ivan
Hello,
Is it possible to redo this behaviour, if there is more content then one date in the field?
Unfortunately no.
If it is not possible, can you provide a method how I could locate such fields before rendering the report and change the field format from “Date” to “General” in the code of the report.
You can use the following code, for example:

Code: Select all

report.Load("example date-format does not show text.mrt");

var comps = report.GetComponents();
foreach (StiComponent comp in comps)
{
    var txt = comp as StiText;
    if ((txt != null) && (txt.TextFormat is Stimulsoft.Report.Components.TextFormats.StiDateFormatService) && txt.Text.Value.Contains("{Format"))
    {
        txt.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiGeneralFormatService();
    }
}
Thank you.

Re: Date Field does not show string anymore

Posted: Tue May 21, 2019 8:13 am
by Scotty2
Thank you.
I will try the code provided.

Re: Date Field does not show string anymore

Posted: Tue May 21, 2019 8:50 am
by Lech Kulikowski
Hello

Ok.
Please let us know if you need any additional help.

Thank you.