Date filter not working

Stimulsoft BI Designer discussion
Post Reply
emacon
Posts: 3
Joined: Tue Feb 13, 2024 4:43 pm

Date filter not working

Post by emacon »

Code: Select all

SELECT
	*
	FROM
	vwBolleVendita
	WHERE
	Azienda = '{Azienda}'
	AND bvt_databolla between '{da_Data_Bolla}' AND '{a_Data_Bolla}'
    AND (bvt_idcausalebolla = 2 OR bvt_idcausalebolla = 8)   -- 2 = Causale_bolla "VENDITA" 8 = Resi da clienti
    AND Tipo_Bolla =
        CASE
            WHEN '{Tipo_Bolla_da_Stampare}' = 'SCONTRINO e FATTURA A PRIVATI' AND Tipo_Bolla = 'SCONTRINO' THEN 'SCONTRINO'
            WHEN '{Tipo_Bolla_da_Stampare}' = 'SCONTRINO e FATTURA A PRIVATI' AND Tipo_Bolla = 'FATTURA A PRIVATI' THEN 'FATTURA A PRIVATI'
            WHEN '{Tipo_Bolla_da_Stampare}' = 'VENDITA' AND Tipo_Bolla = 'VENDITA' THEN 'VENDITA'
            WHEN '{Tipo_Bolla_da_Stampare}' = 'VENDITA' AND Tipo_Bolla = 'RESO CLIENTE' THEN 'RESO CLIENTE'
            ELSE ''
        END;
Is this query syntax correct?

I am having a problem in every report I create. When there is a date filter like the one in this query (

Code: Select all

AND bvt_databolla between '{da_Data_Bolla}' AND '{a_Data_Bolla}'
), the report never shows any data.

Any other report that does not have a date filter but uses the same syntax works perfectly. Can someone help me resolve this issue?

Additional Information:

The query is using MySQL syntax.
The date filter is using the BETWEEN operator.
The report is not showing any data when the date filter is applied.
Other reports that do not have a date filter are working fine.
The date values in the bvt_databolla column are in the correct format. Both bvt_databolla, da_Data_Bolla and a_Data_Bolla are Datetime values.
I have already tried using the DATE() function to extract the date from the bvt_databolla column, it didn't work.
I have already tried using a different filter like "WHERE bvt_databolla >= '{da_Data_Bolla}' AND bvt_databolla <= '{a_Data_Bolla}'", it didn't work, in fact, the report started to give Timeout exception errors.
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: Date filter not working

Post by Lech Kulikowski »

Hello,

What is the type of the da_Data_Bolla and a_Data_Bolla variables?

Thank you.
emacon
Posts: 3
Joined: Tue Feb 13, 2024 4:43 pm

Re: Date filter not working

Post by emacon »

Lech Kulikowski wrote: Fri Feb 23, 2024 9:48 am Hello,

What is the type of the da_Data_Bolla and a_Data_Bolla variables?

Thank you.
As i already wrote in my question, they are Datetime values.
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: Date filter not working

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
Post Reply