This page is for data modellers who want to display data on a screen in a grid.
Overview
PhixFlow can display any Table data as a grid on GUI screens. This page will show you how to add data as a grid to any screen. It will go through a worked example of creating a grid of employees from various companies.
Creating an Employees Grid
Once you have a screen created it is simple to add any data to it. To add data:
- Click List Tables
- Drag and drop the desired table onto the screen. In this instance, the Employees table is dragged onto a screen.
- PhixFlow then asks how to display the data using:
- Click Grid
- The attribute picker should then appear. Drag and drop the attributes to display directly onto the grid.
Relational Attributes
The Employees table has a relationship with a Company table. See the below ERD.
Each employee has a company ID associated to it and is stored in a foreign key attribute, Company. This attribute is linked to the primary key (id_1) of the Companies table. The Companies table also has a display name attribute (CompanyName). This is the attribute that is displayed on the front end when adding a foreign key to any data bound component. For more information on ERD diagrams and relational views, see Entity Relationship Diagrams.
Adding foreign key attributes
When a foreign key, e.g. Company from the primary table Employees, is added to the grid, PhixFlow does the following automatically:
- adds the display name attribute (CompanyName) from the related table (Companies).
This attribute is marked with in the grid header, - hides the foreign key.
Adding relational attributes from a many:1 relationship
On the above grid the user also wants to display the companies address on the same grid. This data is stored on the Company table and can be accessed using the relationship. To add the company address
- Right click on the grid and click Show attributes for 'Employees'
- Click the related table Companies(Company)
- Drag and drop the attribute Address onto the grid.
This attribute is marked with on the grid header.
Adding relational attributes from a 1:many relationship
The user creates another screen to display the company data and wants to display the number of employees for that company using their 1:many relationship. Using an attribute from a 1:many relationship causes aggregation of the data. The most simple case is to use the count() attribute.
To add a relational attribute from a 1:many relationship:
- Right click on the grid and click Show attributes for 'Companies'
- Click the related table Employees(Company)
- Drag and drop the attribute Count() onto the grid.
This attribute is marked with on the grid header. It is counting all the records on the Employees table which have that company as its foreign key value. - Rename the attribute using the label to Number of Employees in the Grid Settings section on the attribute editor.
todo- redo GIF when Count() is available
Adding any other attribute on the table will also cause aggregation. A default aggregate function is added to the attribute added. If more than one attribute is added the aggregation is combined. The default aggregate function can be changed by
- Open the attribute editor by clicking on the attribute column header
- Add an Aggregate function using the drop down under Basic Settings.
For more information on aggregation, see Aggregating Data.
PhixFlow sets the following defaults:
Data Type | Default Aggregation |
---|---|
String/Bigstring | Count |
Integer/Float/Decimal | Sum |
Date/DateTime | Max |
TrueFalse | Max |
Making Grids Editable
Marking Columns as Editable
By default all grid attributes are read only. Grids can be made editable by
- Click on the attribute column header to open its property editor
- Open Grid Settings
Untick Read Only
Strings, Bigstrings, Integers, Floats and Decimals allow users to type to change its value
Dates and Datetimes have a date picker to change its value
Display name attributes will automatically appear as a drop down. Selecting a different value, e.g. Company, will automatically update the ID stored in the foreign key attribute
Saving data
To save changes to editable attributes
- Right click on a grid and Show the view configuration
- Open the Advanced section
- Tick Auto Save
This will automatically save any changes made to the grid. An action can be added as a save action below this field if required.
Drop downs
Any attribute can have a drop down added for a user to select a value. See View Attribute.
More Information
For a complete list of view properties and their functions see View.