How to bind tables to a database
In this video, you will learn how to bind tables to a database in Centrldesk.
In this video, you will learn how to bind tables to a database in Centrldesk.
Tables are important elements in graphical user interfaces to show data clearly in a structure and context. In this example, we connect a table to a database table to display its contents. So let's start building our application:
Steps:
- We have already created a table with three columns.
- First we go to the page editor by clicking on the Edit Page buttonin the upper right menu.
- The Page Editor opens.
- Before we start we must first create a database and a database table, which we want to bind to our table in the graphical user interface.
- Select the green icon for Database on the left side.
- Click on new database.
- The Create App Component Database dialog opens.
- Enter a name for the database and confirm by clicking Create.
- Click on new table.
- The table configuration dialog opens.
- Enter a name for the table.
- For the Type, select Object.
- Under Object Type select the entry "Create Type".
- The Edit Object Type dialog opens.
- Enter a name.
- Click on "Add Property" to add a property.
- Enter "First Name" as the name.
- Select the value "Text" for Type.
- Click on "Add Property" to add a property.
- Enter "Last Name" as the name.
- Select the value "Text" for Type.
- Click on "Add Property" to add a property.
- Enter "Position" as the name.
- Select the value "Text" for Type.
- Confirm your entries by clicking Save.
- Confirm your entries again by clicking Save.
- Click on New row top right.
- The Edit new Row dialog opens.
- Now enter sample data for First Name, Last Name and Position so that we can see an entry in the table in the graphical user interface in our example.
- Confirm your entries by clicking Save.
- Now we have created a database with a table.
- On the left side, click the purple icon for Pages.
- Click on the "Home" page to return to your graphical user interface.
- Select the table.
- On the right side under Data we select the value Flow for Data Source.
- For Row Data Type we select the value Data Row.
- At Table we select the table we have created.
- Now we click on Data Provider.
- The flow editor opens.
- Drag and drop the database element under app components in the middle of the flow editor.
- The Use Database dialog opens.
- Select the entry Get All rows and confirm with ok.
- Drag and drop the Logic element under general in the middle of the flow editor.
- Connect the output of the Get All Rows block to the input of the Logic block.
- Select the logic block.
- Click on edit.
- The Logic Editor opens.
- Drag and drop the Rows of table element under data from previous blocks in the middle of the logic editor.
- Drag and drop the Set Data rows element under scope in the middle of the logic editor.
- Connect the output of the Rows of table block to the input of the Set Data rows block.
- Close the Logic editor by clicking close in the upper right corner.
- Close the flow editor by clicking close in the upper right corner.
- Now we click on Data to Row Mapping.
- The Logic Editor opens.
- Drag and drop the data row element under scope in the middle of the logic editor.
- Drag and drop the Data Row element under Libraries in the middle of the logic editor.
- The data row dialog opens.
- Select Split Data Row and confirm with ok.
- Drag and drop the Workspace Object element under Libraries in the middle of the logic editor.
- The Workspace Object dialog opens.
- Select Split Employee and confirm with ok.
- Drag and drop the First Name element under scope in the middle of the logic editor.
- Drag and drop the Last Name element under scope in the middle of the logic editor.
- Drag and drop the Position element under scope in the middle of the logic editor.
- Now the outputs of the blocks must be connected to the corresponding inputs of the blocks.
- The preview values help the user to connect the database values to the table columns.
- Close the Logic editor by clicking close in the upper right corner.
- Close the Page Editor by clicking close in the upper left corner.
- Now we can see our table with the related entries from the database in our application.