Example: Calling a Custom Function in a Customizable Class

The following example shows a custom function call within a table query.  It filters the data displayed by a Show Table page for the Products table that’s in the Northwind database, and shows only product records that have an “on order” level that exceeds 65 units.

This code is inserted into the Show Products Table page’s customizable class at the end of the ShowProductsTable class (this is the first class of three class definitions in the file).

' returns the maximum On Order level currently allowed

Public Shared Function MaxOnOrderLevel() As String

     ' (For simplicity, this function simply returns a hard-coded value.

     '  In a "real-world" application, this value would probably be

     '  calculated dynamically by some external process.)

 

     ' Maximum On Order level is sixty-five units

     Return "65"

 

End Function

Note this function can actually be added anywhere in the project that’s accessible by the Show Table Page’s classes.  In this case, the custom function is a shared method on the Show Table Page’s customizable class.

In Iron Speed Designer, a query selection criteria (WHERE clause) is added that selects records that have a UnitsOnOrder level greater than the custom function ShowProductsTable.MaxOnOrderLevel().

Products.UnitsOnOrder > ShowProductsTable.MaxOnOrderLevel()

See Also

Calling Custom Code Functions in WHERE Clauses

Example: Calling a .NET Framework Function

Example: Calling a Custom Function in a Customizable Class