Skip to Content
0
Former Member
Feb 05, 2016 at 04:16 PM

Set Filter + isResultSetEmpty On Startup?

208 Views

I have a requirement to set the filter on the data to the current year and current quarter at start up, only if there is data for the time period. If there is no data for that time period, then set the filter to the previous year.

In application start up I did have

DS_1.setFilter("INVOICE_YEAR","2016");

if (!DS_1.isResultSetEmpty())

{

DS_1.setFilter("INVOICE_QUARTER","01");

if (DS_1.isResultSetEmpty())

{

DS_1.clearFilter("INVOICE_QUARTER");

}

}

else

{

DS_1.setFilter("INVOICE_YEAR","2015");

if (!DS_1.isResultSetEmpty())

{

DS_1.setFilter("INVOICE_QUARTER","04");

if (DS_1.isResultSetEmpty())

{

DS_1.clearFilter("INVOICE_QUARTER");

}

}

}

The problem is that even though there is no data for 2016, DS_1 says that it is not empty and the else does not happen.

I then put that code into the DS_1 On Result Set Change and the I get the same result.

What am I doing wrong? Is this not possible? If this is not possible, then what is the work around?

Thanks for your help with this,

Pete