How to use SQL code in visibility component

We use visibility component when we want to hide components from form in some situations. This tutorial shows you how to hide component from form by using visibility component and SQL Code. In our example we will hide buttons Edit Product and Delete Product if there is no products in our database.

Visibility component

For this tutorial, you have to login into developer panel of your application.

1. Login into developer panel of application.

2. Click on Pages menu item.

3. Select page pageProduct.

4. Drag and drop Visibility component from all components list to component named buttonEditProduct that is located on table component named dataTableProduct.

Visibility component with steps

5. In dropped visibility component properties, for Data source type property choose SQL Code.

6. Click on Data source SQL field and enter your SQL query that will be executed on your database. If result of this SQL query has more than 0 rows, component will be shown, otherwise component will be hidden.

Visibility component with sql code

7. Repeat steps 4, 5 and 6 for component named buttonDeleteProduct.

8. Click on Save changes, go into your application and check out the results.