Tables and Queries Examples

Example: Editing Records in a Table

How to edit the contents of an existing record using mouse and keyboard.

Example: Adding Records to a Table

How to add a new record to a table using mouse and keyboard.

Example: Create a Table and Add a Record

Create a table with required fields and then add a record with value for those fields.  Creates the OGR-required table to prepare a Manifold project for use by OGR as detailed in the Example: Connect to Manifold from QGIS topic.

Example: Add a Field to a Table and Fill It

We add a field to a table and simultaneously for all records fill the field with a specified value.

Example: Add a Computed Field to a Table

In this example we add a computed field to a table, illustrating how the computed field automatically changes when changes are made in the fields it uses for computation.   We also show how computed fields can use geometry, automatically updating centroids when areas are changed.  Last, we show how geometry can be created using computed fields, to create effective radius circles for antennas based on the power of the antenna.

Example: Add a Second Computed Geom Field to a Table

We can create tables with more than one geom field in the table and then we can create drawings which use those additional geom fields.   This topic shows how to create a second geom that is a computed field based on the first geom.  The topic also shows some "real world" methods, such as how to remember the use of a geometry function to do what we want, and how to restore a geom that has been moved.    We close with some illustrations of how multiple geoms might be used, and how selection from any drawing or labels based on the same record selects the corresponding objects or labels in all other components based on that record.

Example: Expression Context and Computed Fields

When creating a computed field in the Schema dialog, using the Expression Context tab can increase efficiency, legibility, and maintainability of the expressions that power the computed field.

Example: Create a Table with a Constraint

Create a simple table that includes a simple constraint upon one of its fields.  

Adding an Index to a Table

A basic topic on adding an index using the built-in capabilities of the mfd_id field.

Example: Add a UUID-based Index to a Table

Create a new computed field that is filled with UUID values on creation and then create an index on that field.   This technique creates an indexed field that has guaranteed unique values for all records and thus the indexed field and record values may be used in other projects.

Example: Add a Spatial Index to a Table

A typical use of an index is to provide a spatial index on a geom field in a table, so the geom data can be visualized in a drawing.  This example shows how to add a spatial index using a geom field in a table.

Example: Create a Geocoded Table from a Drawing

A partner example to Example: Create a Drawing from a Geocoded Table   A geocoded table has records with a latitude and longitude for each record.   This example starts with a table for a drawing of points where the geom field in the table contains geometry information for each point.   We extract the Y and X locations for each point  from the geom field to create latitude and longitude fields in the table for each record.

Example: Street Address Geocoding

Geocode a table of street addresses using the Google geocoder.

SQL Example: Create a Table with a Constraint via a Query

A simple example using SQL to create a table with a constraint.

SQL Example: Force an Anomaly in Constraints

Constraints are only evaluated when we insert or update records.   If a constraint refers to external data, such as the values in a different table, we can force an anomalous condition where the table with the constraint may contain data that no longer meets the requirements of the constraint.

SQL Example: Using the mfd_id Field and mfd_id_x Index

A sequence of SQL examples of working with the mfd_id field and mfd_id_x index.   

Example: Create a Table from Locations

Create a table that contains, as records, all of the Locations components in a project.  Each record contains the Name, Latitude, Longitude, and Scale of a location.  We use simple, point-and-click operations using the Select and Transform panes.