Page 1 of 1

Date filter not working

Posted: Thu Feb 22, 2024 11:33 am
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.

Re: Date filter not working

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

What is the type of the da_Data_Bolla and a_Data_Bolla variables?

Thank you.

Re: Date filter not working

Posted: Mon Feb 26, 2024 9:33 am
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.

Re: Date filter not working

Posted: Mon Feb 26, 2024 9:35 pm
by Lech Kulikowski
Hello,

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

Thank you.