Question:
In an application, a Query has a filter with several variables, which enables the filter to be set up on screen:
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:
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 “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.