Example: Using the Select Panel Saved Tab

This example shows how to use the Select panel Saved tab to save selections and to then re-use those selections in various combinations.

 

In this example we will work with a Products table created from the ubiquitous nwind example database.  The table shows a list of products for a hypothetical vendor of food and beverage products.   For the sake of this example we have deleted some of the fields in the usual Products table, thus providing less-cluttered illustrations.

 

eg_seldlg_saved01_01.png

 

In the table we have Ctrl-clicked on the row handles of two of the records to select them.  We click on the Contents pane and then on the Select panel.  We click on the Saved tab.

 

eg_seldlg_saved01_02.png

 

 

The table has no boolean fields in it, including no saved selection boolean fields, so the list in the Saved tab is empty.   To add the current selection as a saved selection we Double-click into the new row blank cell.

 

eg_seldlg_saved01_03.png

 

We enter a name for the new saved selection.  We will call it Anton because the two selected products are both in the Chef Anton's product line.

 

eg_seldlg_saved01_04.png

 

We press the Enter and Immediately in the Saved list the Anton saved selection appears.  Since the new saved selection is the active cell in the Saved grid, it previews in blue preview color the records it would select.   Because those records are still selected and would normally be shown in red selection color, the result of a blue preview color overlaid on the red selection color is a blended color.

 

eg_seldlg_saved01_05.png

 

If we look closely at the table we see that a new field called Anton has been added.  The new Anton field is a boolean field with values of true or 1 for each record that is in the saved selection and false or 0 for each record that is not in the saved selection.     This method of saving selections by using a boolean field is extremely simple and very open and obvious.  It is hard to mess up.

 

eg_seldlg_saved01_06.png

 

Suppose now we choose Edit - Select None in the main menu to clear the selection.  

 

 

eg_seldlg_saved01_07.png

 

Back in the Select panel we can retrieve our saved selection instantly by simply clicking on the Anton field to highlight it in the Saved tab.  The dialog immediately previews that saved selection for us in blue preview color in the table.   The dialog knows that any record with a value of true in the Anton field should be selected.  

 

We can now use the Anton saved selection however we like in combinations specified by the command button at the bottom of the dialog.  We could click on the default Replace Selection command button mode to make that saved selection the current selection in the table.   If the table already had some other selection we could use one of the other modes for the command button to add to the selection, subtract from the selection, intersect with the selection or invert with the selection.  

Changing a Saved Selection

Suppose we would like to change a saved selection... how can we do that?

 

eg_seldlg_saved01_08.png

 

Suppose, for example, that Chef Anton adds to his empire of food products by acquiring the makers of the licorice syrup and fish roe products listed in the Products table.  We would like to add these products to the saved selection we call Anton.   That's easy to do.  We make the selection we want in the table.

 

 

eg_seldlg_saved01_09.png

 

Next, we Ctrl-click on the row handle for the Anton saved selection to select it in the Saved list..

 

eg_seldlg_saved01_10.png

 

We press the Capture button and the Anton saved selection will now be updated to contain whatever is the current selection in the table.

 

eg_seldlg_saved01_12.png

 

If we take a close look at the contents of the Anton field in the table, we see that now all of the selected products have a true in the Anton field.

 

It is worth repeating the saved selections mechanism in Manifold is deliberately kept simple so it is easy to use and open to alternative ways of using the mechanism.   For example, we didn't have to update the Anton field by using the Capture button.   We could have changed the saved selection by using the Transform panel to change the values in the Anton field for selected records from false to true.  In more complex scenarios we could use SQL.

 

All Boolean Fields Appear in the Saved Tab

There is nothing magical about the boolean fields used to store saved selections.  Any boolean field that is in the table will appear in the Saved list and could be used by the Select panel as a saved selection.

 

eg_seldlg_saved01_13.png

 

For example, suppose our table had a boolean field in it called Promo that was used to mark those products which are part of some marketing promotion, such as a special discount.   A product with a value of true or 1 in the Promo field is eligible for the discount and those products with a value of false or 0 in the Promo field are not eligible.

 

eg_seldlg_saved01_14.png

 

Looking at the schema of the table there is nothing special about the Promo field: it is just a boolean field.  Note that the schema shows all fields in the table, including those we have hidden to allow less-cluttered illustrations.

 

eg_seldlg_saved01_15.png

 

If our table did have a boolean field called Promo it would also appear in the Saved list in the Select panel.  If we clicked on it to highlight the Promo field in the Saved list, the Select panel would interpret the values in that field for use as a saved selection, previewing them in blue preview color in the table just as it did for the Anton saved selection field.   The Promo saved selection will select all records that are eligible for the marketing promotion.

 

That is a very useful effect as quite often we might want to make selections in tables based on the values of existing boolean fields, for example, selecting all records participating in a promotion.   Because boolean fields usually indicate some sort of included or not included status they naturally lend themselves to use as selection criteria for records being in or out of a selection.

 

That useful effect might lead to confusion if we forget which boolean fields we added to the table for saved selections and which were part of the original structure of the table.  For example, if we do not work with this table for a few weeks or months the next time we open it we might not remember exactly what was intended with the Anton field that is now part of the table.

 

To avoid confusion with boolean fields not intended to store saved selections it makes sense to choose names for the selections which we save that will make it immediately obvious those fields were intended to save selections.

 

We might get in the habit of appending _s to saved selection names as a reminder the field is for a saved selection, using a name like Anton_s in the above example.    That will make clear later on which boolean fields were added to the table to save selections and which boolean fields were part of the original schema of the table.

 

If we want to use saved selections only for the duration of a particular work session and not permanently change the schema of a table that is easy to do: when we are finished using the saved selections we Ctrl-click them to select them in the Saved tab and then we press the Delete button, which removes that saved selection from the Saved list and the associated boolean field from the table.

 

Of course, when deleting saved selections we should take care not to delete any boolean fields that appear in the Saved list which were part of the original schema of the table, as they may be in use in the table for purposes other than saving selections.

 

Notes

Example tables - In this topic we use tables adapted from the ubiquitous nwind example database.  To keep the illustrations as small as possible to fit into this documentation we frequently show panels overlapping the table windows.  There is no requirement to overlap a table window with a panel.   Doing so allows us to fit more panels and tables into a smaller illustration.

 

Transition from pre-Radian products -  The Select panel provides within a single panel the functionality of the Selection Toolbar, Saved Selections pane and Selection Modes in pre-Radian versions of Manifold GIS.

 

See Also

Selection

 

Contents Pane

 

Contents - Select

 

Contents - Transform

 

Example: Using the Select Panel Template Tab -  A sequence of actions using Select panel templates.

 

Example: Construct JSON String using Select and Transform - Use the Select panel and Transform dialog to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.