Fields > Zoho Creator Field Types > Configuring conditional drop downs

Configuring conditional drop downs

Tags:  

You can use the Set Criteria option in lookup fields to restrict the entries that will be displayed in the lookup field, based on a given criteria. Let us take the example of the Library Manager application, which consists of the following forms:

  1. Book form with the fields (Name, Author, Status). The Status field can have one of the following values 'Available' / 'Issued'
  2. IssueBook form with the fields (BookName, IssueDate and IssuedTo). Here, the field 'BookName' is a look up to the 'Name' field of 'Book' form.

    By default, the field 'BookName' in 'IssueBook' form will display all the books present in the 'Book' form. But our requirement will be to list only the books with Status as 'Available' in the 'BookName' picklist field. We can easily achieve the above requirement by giving the following criteria for the look up field 'BookName'. In the screen-shot given below, the deluge criteria Status="Available", is added to the BookName lookup field.

  3. The equivalent deluge script definition of the Book_Name field is given below.


    	Book_Name
    (
    displayname = "Book Name"
    type = picklist
    values = Books[Status == "Available"].Name
    )

    Another widely used scenario is restricting the picklist entries based on the user who logs into the application. For example, assume that an organization has created an appraisal form to be used by managers to appraise his subordinates. When a manager logs in, only his subordinates must be available for choosing in the employee picklist. In this case, the lookup field will be the 'Employee_Name' from 'Employee' form and the 'Set Criteria' will be ManagerMailID == zoho.loginuserid, where ManagerMailID, is the deluge field name in the Employee form which holds the zoho login emailid of the manager and zoho.loginuserid returns the email id of the user who has logged into the application.

    Also Refer: Tips & Tricks -> Display Picklist based on loginuser.


0 Comments  Show recent to old
Post a comment


 RSS of this page