Click or drag to resize

SavedFilter Class

Holds information about a filter. These are commonly used to store IMapper filtering. SavedFilters are stored in the xot_saved_filter table in the relevant database and exposed via the IAppContext.Filters collection.

SavedFilters may be static or dynamic:

  • Dynamic - Dynamic filters are the most common and default filter type. Dynamic filters use a SQL WHERE clause that is applied to the mapper's query. The filter is dynamic because the resulting records may change due to changes in those records' data.
  • Static - Static filters always filter on the same set of keys and so the resulting records are always the same. These keys are stored in the xot_saved_filter_keys table in the operational database and associated with a specific SavedFilter. In the case of a static filter, the SavedFilter Filter will be a subquery against that table.
You can convert a Dynamic filter to a Static filter using one of the Convert(IAppContext, IDatabase, SaveFilterConvertOptions, Int32) overloads. At this time it is not possible to convert a Static filter to Dynamic filter.

You can obtain a SavedFilter from an IMapper using the FilterSave command. This will cause the mapper to created a SavedFilter reflecting its current filtering including any FullTextSearchValue. It will also include a comprehensive Description for the filter. You can apply a SavedFilter to an IMapper using the SavedFilterApply command. This will apply the Filter clause as well as any FullTextSearchValue.

SavedFilters provide a safe way to include mapper filtering in a URL. You can use one of the RegisterReqFilter overloads to save a filter clause to the operational database and return a unique signature that can be included as the value for the standard flt parameter in a navigation url. Filters referenced in this manner can be included in a URL without risk of a SQL injection attack. You can use one of the ExtractFilterFromReq overloads to obtain a SavedFilter from a registered filter query parameter.

Inheritance Hierarchy
SystemObject
  NetQuarrySavedFilter

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
[SerializableAttribute]
public class SavedFilter

The SavedFilter type exposes the following members.

Constructors
  NameDescription
Public methodSavedFilter
Full constructor for the SavedFilter class.
Top
Properties
  NameDescription
Public propertyAttributes
The FilterAttributes for the filter.
Public propertyCreateDate
The UTC date/time at which the filter was created.
Public propertyCreatorID
The creator of the filter.
Public propertyCriteria
The criteria use to create the filter. This XML stores criteria information that can be used to maintain the filter.
Public propertyDescription
The localized description of the filter. A more verbose description is available from VerboseDescription.
Public propertyEndDate
The optional UTC date/time at which the filter expires. See also StartDate.
Public propertyFilter
The SQL filter clause for the filter. Note that for true static filters the filter clause will a subquery against the xot_saved_filter_keys table.
Public propertyFrom
The SQL FROM clause (typically a table or view name) for which the filter is intended.
Public propertyFullTextSearchValue
The fulltext search value for this filter. Used in conjunction with FullTextTable.
Public propertyFullTextTable
The fulltext table for this filter. Used in conjunction with FullTextSearchValue.
Public propertyID
The unique (GUID) ID for the filter. The ID serves as the key in the SavedFilters collection.
Public propertyKeyColumn
The column in the underlying table containing the single primary key uniquely identifying a row in the table. This key is used in filter clause building.
Public propertyKeyCount
Gets the number of keys for this static (Static) filter. If the filter is not static, or the number of keys cannot be determined, -1 is returned. Note that, for performance reasons, KeyCount is preferred over flt.Keys.Count if no other use of the Keys collection is being made because accessing the Keys collection will cause the keys collection to be loaded if it was not already loaded.
Public propertyKeys
The list of keys for a static filter. If the filter is not marked Static then an empty set will be returned. Note that accessing the Keys collection on a static filter will cause the collection to be loaded from the xot_saved_filter_keys table. For improved performance, if the Keys collection is being accessed solely to get the count, use KeyCount which will not cause the collection to be loaded.
Public propertyKeysLoaded
Gets/Sets a boolean value that indicates if the Keys for this filter have been loaded.
Public propertyLocaleKey
The locale of the base filter. Note that if localized text is available for the filter it will be used in place of the original, non-localized text from this locale.
Public propertyModuleKey
The module to which this filter belongs.
Public propertyMoniker
The pseudo-unique moniker for the filter. Ideally, this should be unique within the SavedFilters collection, but is not guaranteed to be so.
Public propertyMOP
The module to which this filter belongs.
Public propertyName
The localized, natural language name of the filter.
Public propertyOwnerID
The owner (if any) of the filter. If no owner is specified then the filter is globally available.
Public propertyPageElementID
Gets/sets the PageElementID for the PageElementInfo for this filter. This should be set only when the filter is specific to the specified page element.
Public propertyPreFilter
The SQL PreFilter clause for the filter.
Public propertySort
The sort clause for the filter, if any.
Public propertyStartDate
The optional UTC date/time from which the filter is valid. See also EndDate.
Public propertyTenantId
The Tenant ID for this filter. Tenant may be NULL.
Public propertyUsage
Gets/sets the filter Usage. The Usage can be used to correlate a filter with a certain set of functionality. You can use UsageSpecific to restrict visibility of the filter.
Public propertyVerboseDescription
The localized verbose description for this filter. A more succinct description is available from Description.
Top
Methods
  NameDescription
Public methodStatic memberCanUserShareFilters
Determines whether the current application/tenant/user is allowed to share filters.
Public methodClose
Close the filter.
Public methodConvert(IAppContext, IDatabase, SaveFilterConvertOptions)
Convert the Saved Filter from one form to another per provided SaveFilterConvertOptions.
Public methodConvert(IAppContext, IDatabase, SaveFilterConvertOptions, Int32)
Convert the Saved Filter from one form to another per provided SaveFilterConvertOptions and applying a TOPN clause.
Public methodCopy
Copy this filter's database records and return a newly created SavedFilter object using them.
Public methodDelete
Delete the filter.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodStatic memberExtractFilterFromReq(IAppContext, HttpRequest)
Extract any general filter clause from the 'flt' parameter of the request. See ExtractFilterFromReq(IAppContext, HttpRequest, String, SavedFilter) for more information.
Public methodStatic memberExtractFilterFromReq(IAppContext, HttpRequest, SavedFilter)
Extract any general filter clause and its SavedFilter from the 'flt' parameter of the request. See ExtractFilterFromReq(IAppContext, HttpRequest, String, SavedFilter) for more information.
Public methodStatic memberExtractFilterFromReq(IAppContext, HttpRequest, String)
Extract any general filter clause from the named HTTP request parameter. See ExtractFilterFromReq(IAppContext, HttpRequest, String, SavedFilter) for more information. Note that calling this overload is the same as calling the ExtractFilterFromReq(IAppContext, HttpRequest) overload specifying 'flt' as the name value.
Public methodStatic memberExtractFilterFromReq(IAppContext, HttpRequest, String, SavedFilter)
Extract any general filter clause from the request. Use this method to obtain the filter clause and SavedFilter specified in the request via the name (defaults to 'flt') parameter. The value must be a special SavedFilter identifier generated using one of the RegisterReqFilter(IAppContext, String) overloads. If the parameter is not present, or its value is blank/null, a blank/null clause will be returned and the returned filter will be null.
Remarks
In early version of the platform providing a raw SQL filter clause was allowed, but due to the risk of SQL injection this is no longer supported and an error will be thrown if a non-blank/empty parameter value is found that is not a recognized SavedFilter identifier.
Public methodStatic memberFilterSignature
Formats a signature for use on a QueryString
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGenerateSubquery(String, DBMSType)
Generate a subquery for this filter appropriate for use in a SQL IN clause.
Public methodGenerateSubquery(String, DBMSType, String)
Generate a subquery for this filter appropriate for use in a SQL IN clause.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodStatic memberGetSchema
Get relevant schema information from cache if already retrieved, else from the database.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLoaded
Mark this filter as loaded from xot_saved_filters.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberCode exampleOpen(IAppContext, String)
Opens the specified filter from the IAppContext.DataDB database and returns the SavedFilter object.
Public methodStatic memberOpen(IAppContext, IDatabase, String)
Opens the specified saved filter from the specified database and returns the SavedFilter object.
Public methodStatic memberRegisterReqFilter(IAppContext, String)
Register a filter clause for use in a URL's flt parameter. Registration will cause a SavedFilter to be created and written to the database. The method returns a filter spec that can be included in a URL without risk of a SQL injection attack. Filters created using this overload will always be marked as Temp with a default expiration and will be restricted to the current user.
Public methodStatic memberRegisterReqFilter(IAppContext, String, NullableDateTime)
Register a filter clause for use in a URL's flt parameter. Registration will cause a SavedFilter to be created and written to the database. The method returns a filter spec that can be included in a URL without risk of a SQL injection attack. Filters created using this overload will always be marked as Temp with a default expiration and will be restricted to the current user.
Public methodStatic memberRegisterReqFilter(IAppContext, String, String, String, String)
Register a filter clause for use in a URL's flt parameter. Registration will cause a SavedFilter to be created and written to the database. The method returns a filter spec that can be included in a URL without risk of a SQL injection attack. Filters created using this overload will always be marked as Temp with a default expiration and will be restricted to the current user.
Public methodStatic memberRegisterReqFilter(IAppContext, String, FilterAttributes, String, String, String, NullableDateTime, String)
Register a filter clause for use in a URL's flt parameter. Registration will cause a SavedFilter to be created and written to the database. The method returns a filter spec that can be included in a URL without risk of a SQL injection attack. You can use one of the ExtractFilterFromReq(IAppContext, HttpRequest, String, SavedFilter) overloads to extract the filter.
Public methodStatic memberRegisterReqFilterUrl
Register a filter clause for use in a URL's flt parameter. Registration will cause a SavedFilter to be created and written to the database. The method returns a filter spec that can be included in a URL without risk of a SQL injection attack. Filters created using this overload will always be marked as Temp with a default expiration and will be restricted to the current user.
Public methodSave
Save the filter to the xot_saved_filters table in the operational database saving any static filter keys as well.
Public methodSignature
Returns a QueryString signature for the saved filter.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodEqualValue
Determines if the object value is equal to another object. If the two objects are null, then this returns true. There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways). If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.)
Top
Remarks
When saved, SavedFilters are stored in the xot_saved_filters table in the operational database.
See Also