Buzzy Documentation
  • Welcome to Buzzy
  • Getting Started with Buzzy
    • Getting Started Guide
      • 1. Starting with Buzzy AI
      • 2. The Buzzy Workspace
      • 3. Create a new app
      • 4. Preview and edit your app
      • 5. Manage your app
      • 6. Import your app to Figma
      • 7. Using Buzzy with Figma
      • 8. The Buzzy Figma plugin
      • 9. Creating a simple app
      • 10. Screens and navigation
      • 11. Forms, fields and data
      • 12. Data-driven menus & content
      • 13. Data edit and delete
      • 14. Search, sort and filter
      • 15. User login and registration
    • Buzzy AI or Figma first?
  • Working with Buzzy
    • Buzzy AI
      • About Buzzy AI
      • Kickstart with AI
      • Enhance with Figma
      • Extend with Code
      • Example prompts
      • Tips
      • Troubleshooting Buzzy AI
      • AI tokens and pricing
    • Buzzy for Figma
      • About Buzzy for Figma
      • Learning Figma
      • Creating a new app directly in Figma
        • Step by step version
      • Automarkup
      • Responsive layouts
      • Responsive layout checklist
      • Overflow and scrolling
      • Forms and fields
      • Images and galleries
      • Logging users in to your app
      • Theming
      • Troubleshooting Buzzy for Figma
      • Plugin error messages
    • Buzzy Deployment & App Stores
      • Setting up your custom Buzzy app
      • Connecting your own server
      • Apple & Google App Stores
    • Buzzy Marketplace
      • Buzzy Accreditation
    • Buzzy Project Guide
    • Buzzy App Examples
      • Buzzy Templates
      • AI-Powered Chat App
      • AI-Powered Custom T-Shirt App
      • AI-Powered Strategy App
      • AI-Powered Stock Portfolio App
      • Golf Course Finder
      • Personal Finance App with Figma AI
    • FAQs
  • The building blocks
    • Datatables, Fields & Data
      • Introduction to Fields
      • Basic Fields
        • Text
        • Number
        • Date
        • Location
        • Toggle
        • Checkboxes
        • Checklist
        • Selectlist
        • Rating
        • Attachments
        • Images
        • Signature
        • Audio Recording
        • Embedded Link
      • Advanced Fields
        • Formula
        • Sub tables
        • Linked Table field
        • Button
        • Teams
        • Payment
        • Notification
        • Event
        • User Vote
      • Display Fields
        • Header
        • Display Text
        • Image
        • Divider
      • Metadata Fields
        • Author Name
        • Author Phone
        • Submitted
      • Filter Controls
        • Viewers
        • Tags
        • Condition
      • External Fields
        • IBM Connections File
        • Box File
      • Sort Fields
      • Formulas
      • Datatable to Datatable Relationships
      • Security and Access Control
      • Displaying a field based on the values of other fields
      • Hiding a field based on role using a display formula
      • Importing data from a text file
      • Importing data from a URL
      • Import data from Datatable
      • Export data using Chrome
      • Export data in Browser
      • Export data using Safari
      • Datatable Field Type - Cheat Sheet
      • Troubleshooting Fields & Data
    • Code widget (custom code)
      • Code Widget Fields - Advanced Guide
      • New Async API + React HTML Components
      • Examples
        • Image Galley Slideshow
        • Ratings Average and Distribution
        • Event Locations Map
    • Analytics
  • Troubleshooting
    • App Error Codes
      • Action Error
      • App Not Found
      • Component Missing
      • Component Not Set
      • Component Settings Error
      • Datatable Not Found
      • Datatable Not Set
      • Field Not Found
      • Field Not Set
      • No App Selected
      • No Context Name
      • No Screens Found
      • Runtime Exception
      • Screen Not Found
      • Screen Not Set
    • Troubleshooting Buzzy AI
    • Troubleshooting Figma
  • REST API
    • Buzzy REST API
      • Integrating 3rd party applications
      • REST API
        • login
        • createappwithprompt
        • MicroApp Data Operations
          • microappdata
          • microappdata/row
          • insertmicroapprow
          • updatemicroapprow
          • removemicroapprow
          • microappchild
        • User & Organization Operations
          • userid
          • insertteammembers
          • teammembers
          • insertorganization
          • insertteam
        • enforceteammembership
      • Node.js API Client
      • Datatable Rules
      • Datatabledata Tutorial
      • Integrating with Mailchimp
      • Python Access Datatable
  • Advanced Deployment Settings
    • Installation
      • Pre-installation Planning
      • Deployment
        • Introduction to deployment
        • Minikube install guide
        • AWS ECS Fargate install guide
        • HCL Connections install guide
        • Azure AKS install guide
        • Windows container install guide
      • Buzzy settings
      • Whitelabelling Buzzy
      • Certificates
      • Release Management
    • Performance and Reliability
    • Security
      • Platform
      • Users and Roles
      • Datatables
      • Audit Trail
Powered by GitBook
On this page
  • Show/hide formulas to the rescue!
  • Some other examples
  1. The building blocks
  2. Datatables, Fields & Data

Displaying a field based on the values of other fields

PreviousSecurity and Access ControlNextHiding a field based on role using a display formula

Last updated 2 years ago

Common scenario: you have a select list with a bunch of options, and the last option is ‘Other - please specify’. If a user chooses this, you want to show them a text field so they can do the ‘please specify’ bit. But you don’t want the text field visible all the time, since it gets in the way and confuses things for other users.

Show/hide formulas to the rescue!

Here’s a simple form - a user enters their name, and chooses their favourite food type. If they select other, we want them to tell us what that is.

In the app settings, here’s what our select box looks like - notice the ‘Other’ in the select options, and we’ve prepared by adding a text field below it:

Now we just need to make sure the text field only displays if the select value is ‘Other’. To do this we use the ‘ Display via rule/formula?’ setting - in this case we set it to ‘Show’ if the value of ‘Favourite food type’ is equal to ‘Other’ (eg `Favourite food type` = "Other"):

Here it is in action:

Note that the field label (‘Favourite food type’) is wrapped in backticks (`) to escape the spaces and special characters, and the value is a string. It’s also case-sensitive, so be precise!

There are loads of possibilities with this capability. You can use true/false values for fields like toggles, strings for text or selectboxes, or check for user roles. You can also string complex formulas together based on combinations of values and roles.

Some other examples

Check for user role, or if user is defined in the ‘viewers’ for the app:

user.highestRole = 'owner' or user.highestRole = 'author'  or (user._id in viewers) 

Check if the row is locked:

isLocked = true 

(or can simplify to just isLocked)

Here’s a complicated example that chains a whole lot of conditions:

isLocked = false 
and $boolean(`Permission`) 
and $boolean(`Signature`) 
and (`Permission` = "Yes" ?  
    $boolean(`Emergency contact`) 
    and (`Payment required` = "Yes" ? 
        $boolean(`Payment options`) 
    : true) 
: true)

What does this do?

  • checks the row is not locked; and

  • ‘Permission’ has a value/exists; and

  • ‘Signature’ has a value/exists; and if

  • ‘Permission’ equals ‘Yes’; then

    • ‘Emergency contact’ must have a value; and if

    • ‘Payment required’ equals ‘Yes’: then

      • ‘Payment options’ must have a value

Phew.


The checkbox field allows one or more values to be selected. The data is stored as an array and the in JSONata operator is used for comparison. If the food types were checkboxes, then the formula could also be written as 'Other' in `Favourite food type` - check for help with formulas.

jsonata.org