KB-32470: Enabling or disabling a Query’s filters

Question:

In an application, a Query has a filter with several variables, which enables the filter to be set up on screen:

SELECT E3TimeStamp, Field1, Field2
FROM Table1
WHERE (E3TimeStamp  >= #<%IniDate%># ) AND ( E3TimeStamp <= #<%FinalDate%># )

 

How can I set up the filter to be enabled or disabled by the operator?


Solution:

To do so, you must create several Boolean variables and write a script in the Query’s SQL tab using the OR condition. For example:

SELECT E3TimeStamp, Field1, Field2
FROM Table1
WHERE ( <%bIni%> = 1  OR (E3TimeStamp  >= #<%IniDate%># )) AND ( <%bFinal%> = 1 OR (E3TimeStamp <= #<%FinalDate%># ))

If the variable is equal to 1, the filter is disabled. If it is equal to 0, the filter is enabled.

The Boolean variables’ values can be configured according to CheckBox objects:

cs.SetVariableValue “bIni”, NOT Screen.Item(“Checkbox1”).Value
cs.SetVariableValue “bFinal”, NOT Screen.Item(“Checkbox2”).Value

Thus, when checking the CheckBox, the variable receives 0 and the filter is enabled. When it is unchecked, the variable receives 1 and the filter is disabled.

Check the attached demo application developed with E3 v. 3.2 b. 260 for more details.

Attachments:

FilterOrNot.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *