Page 1 of 1

Date Format in Filter section

Posted: Mon Jun 07, 2010 1:42 am
by aussiegirl
Hello

I am using the filters from a WinForm application and the date format I use is dd/MM/yyyy on the Form which is correct, but on the DataBand filter the dates are entered in as MM/dd/yyyy which doesn't filter the correct results

Thank You

Date Format in Filter section

Posted: Mon Jun 07, 2010 3:24 am
by Andrew
Hello,

In the databand filter, when you specify a filter by date, dates are output using the date time picker.
Its result does not depend on the string format of a date.
Or maybe you use date as a string?

Thank you.

Date Format in Filter section

Posted: Mon Jun 07, 2010 5:43 am
by aussiegirl
Hi Andrew

This is what I was using

Code: Select all

Datasales.Filters.Add(New StiFilter("InvoiceDate", StiFilterCondition.Between, Format(dtpDateFrom.Text, "dd/MM/yyyy"), Format(dtpDateTo.Text, "dd/MM/yyyy"), StiFilterDataType.DateTime))

Thank You

Date Format in Filter section

Posted: Tue Jun 08, 2010 2:52 am
by Jan
Hello,

Please use following code:

Code: Select all

StiDataBand dataBand = report.GetComponentByName("DataBand1") as StiDataBand;
            if (dataBand != null)
            {
                dataBand.Filters.Add(new StiFilter("InvoiceDate", StiFilterCondition.Between, DateTime.Now, DateTime.Now));
                report.Design();
            }
Thank you.

Date Format in Filter section

Posted: Tue Jun 08, 2010 7:27 am
by aussiegirl
Hi Jan

I don't understand why I would use the DateTime.Now? The dates are coming from a Form within the Report, so there is a DateFrom and DateTo. So the date range is going to be selected by the users.

Thank you.

Jan wrote:Hello,

Please use following code:

Code: Select all

StiDataBand dataBand = report.GetComponentByName("DataBand1") as StiDataBand;
            if (dataBand != null)
            {
                dataBand.Filters.Add(new StiFilter("InvoiceDate", StiFilterCondition.Between, DateTime.Now, DateTime.Now));
                report.Design();
            }
Thank you.

Date Format in Filter section

Posted: Wed Jun 09, 2010 2:12 am
by Jan
Hello,

I have provided this code only as sample. You can use your variables instead DateTime.Now. For example:

Code: Select all

dataBand.Filters.Add(new StiFilter("InvoiceDate", StiFilterCondition.Between, date1, date2));
Thank you.