The DataEngine.FilterChanged script allows you to perform any necessary tasks after the user has changed the filter for a report, either by adding, editing, or removing conditions.
Parameters
A reference to the Stonefield Query Application object.
Return Value
Any value (Stonefield Query ignores the return value).
Example
Suppose the Select script a table uses needs to know if the user is filtering on the CUSTOMERS.TYPEID field (perhaps it has to look up values in another table). The DataEngine.FilterChanged script could store the value the user is filtering on in a property of the Application object the Select script uses.
Visual FoxPro
lparameters toApplication as SQApplication
local loFilters, lnI, loCondition, liType
loFilters = toApplication.DataEngine.FilterConditions
for lnI = 1 to loFilters.Count
loCondition = loFilters.Item(lnI)
if loCondition.FieldName = 'CUSTOMERS.TYPEID'
liType = loCondition.Values.Item(1)
toApplication.AddProperty('CustomerTypeFilter', ;
liType)
endif
next
VBScript
function Main(Application)
dim Filters, Condition
set Filters = Application.DataEngine.FilterConditions
for I = 1 to Filters.Count
set Condition = Filters.Item(lnI)
if Condition.FieldName = "CUSTOMERS.TYPEID"
TypeID = Condition.Values.Item(1)
Application.AddProperty("CustomerTypeFilter", _
TypeID)
end if
next
end function
JavaScript
function Main(Application, SelectStatement) {
var Filters, I, Condition, TypeID ;
Filters = Application.DataEngine.FilterConditions ;
for (I = 1; I <= Filters.Count; I++) {
Condition = Filters.Item(lnI) ;
if (Condition.FieldName = 'CUSTOMERS.TYPEID') {
TypeID = Condition.Values.Item(1) ;
Application.AddProperty('CustomerTypeFilter',
TypeID) ;
}
}
}
C#
Please note that the method in this script must be named DataEngine_FilterChanged.
public static void DataEngine_FilterChanged(SFQApplication sfqApplication)
{
foreach(FilterCondition filter in sfqApplication.DataEngine.FilterConditions)
{
if(filter.FieldName.ToUpper() == "CUSTOMERS.TYPEID")
{
string typeID = (string)filter.Values.Item(0).Value;
sfqApplication.AddProperty("CustomerTypeFilter", typeID);
break;
}
}
}
VB.NET
Please note that the method in this script must be named DataEngine_FilterChanged.
public shared function DataEngine_FilterChanged(sfqApplication as SFQApplication) as Boolean
For Each filter As FilterCondition In sfqApplication.DataEngine.FilterConditions
if filter.FieldName.ToUpper() = "CUSTOMERS.TYPEID" Then
Dim typeID As String = filter.Values.Item(0).Value
sfqApplication.AddProperty("CustomerTypeFilter", typeID)
Exit For
End If
Next
Return True
End Function
See also
DataEngine Object | Scripts© Stonefield Software Inc., 2024 • Updated: 06/06/16
Comment or report problem with topic