Share via


HASFILTER Function (RecordRef)

Determines whether a filter has been applied to the table that the RecordRef refers to.

Syntax

  
Ok := RecordRef.HASFILTER  

Parameters

RecordRef
Type: RecordRef

The RecordRef that is used to identify the table.

Property Value/Return Value

Type: Boolean

true if the table referred to by RecordRef has a filter; otherwise, false.

If you omit this return value and if the record cannot be found, a run-time error occurs. If you include the return value, it is assumed that you will handle any errors.

Remarks

This function works just like the HASFILTER Function (Record).

Example

The following example opens the Customer table with a RecordRef variable that is named RecRef. The HASFILTER function determines whether a filter has been applied in the Customer table. The function returns false because no filters are applied. The return value is stored in the varHasFilters variable. The SETRECFILTER Function (RecordRef) is used to set a filter. The HASFILTER function now returns true. This example requires that you create the following variables and text constant in the C/AL Globals window.

Variable name DataType
RecRef RecordRef
varHasFilters Text
Text constant name DataType ENU value
Text000 Text Are there any filters? %1
  
RecRef.OPEN(DATABASE::Customer);  
VarHasFilters := RecRef.HASFILTER;  
MESSAGE('Are there any filters? %1', VarHasFilters);  
RecRef.SETRECFILTER;  
VarHasFilters := RecRef.HASFILTER;  
MESSAGE(Text000, VarHasFilters);  

See Also

RecordRef Data Type