Criteria / Filters in Views



Creating Views

 

By default, all the entries in a form will be displayed in the view. Filters are a set of named criteria that allows you to select only specific entries in a view. Default filters will be created for single-select and multi-select fields. The Deluge syntax to display all the rows in a form with default filters, is given below.

Syntax

list  <"View Name">
{
    show  all  rows  from  < Form Name > 
    (
        < Field name >
        < Field name >
        < Field name >
        < Field name >
        
    )
    filters 
    (
        < Single select/Multiple select Field name >
        < Single select/Multiple select Field name >
              
    )
} 
      

 

Base criteria

 

While getting a book from the library, you will definitely like to first look at the books list that has not been issued to anybody. This is a often required feature. This can be easily achieved by setting matching criteria while creating views. To specify the base criteria in script mode, add the required criteria as highlighted in the code below.

 

list  "ApplicationForm_View"
{
show all rows from ApplicationForm [EducationalQualification == "Diploma"]
(
Name
DateOfBirth as "Date Of Birth"
EmailId
Experience
ContactAddress as "Contact Address"
ContactNumber as "Contact Number"
BloodGroup as "Blood Group"
EducationalQualification as "Educational Qualification"
)
filters
(
EducationalQualification
Experience
BloodGroup
)
}

 

In the above code, only those records in the ApplicationForm whose Educational Qualification is Diploma can be viewed by the user, as shown in the screen shot below. If the base criteria is not specified, all the records can be viewed by the user.

 

 

Auto Filter

 

Zoho creator creates default filters for the fields belonging to any of the following types. These filters are called "Auto filters".

It is enough to just specify the name of the field as the filter, as specified in the sample code below. For example:

 
filters
(
    Qualification
    Experience
	  Blood Group
)

 

In the Zoho Creator GUI mode, the default filters will be displayed. You can enable/disable the auto filters by selecting/deselecting the show checkbox. By default, it is disabled.

 

 

 

Name of the field will be taken as the name of the filter. The values for the fields will get displayed in the Filters drop down list in the live mode. See the below image. Selecting a filter name, will display only those records that satisfy the filter criteria.

 

 

 

 

Custom Filter

 

Custom filters are a set of named criteria that can be defined by the user. At present, only simple criteria can be defined in the GUI mode. See the image below.

 

 

It only has match alland match any. The deluge script generated for the above custom filter is highlighted below:

 

filters 
(
EducationalQualification
Experience
BloodGroup
"Diploma with 2 years experience" : (EducationalQualification == "Diploma" && Experience == "2 years")
)

 

 

To define slightly complex ones, like having both a AND and an OR operator, deluge scripting is needed. See the sample given below:

 

filters 
(
EducationalQualification
Experience
BloodGroup
"Diploma with 2 years experience" : (EducationalQualification == "Diploma" && Experience == "2 years")
"Diploma/PostGraduate" : ((EducationalQualification == "Diploma" && Experience == "2 years") || Educational
Qualification == "PostGraduate")

)
}

 

Here "Diploma/PostGraduate" is the name of the custom filter and any boolean expression can be given as the criteria. To know more about the expressions in deluge scripting, refer to Expressions.