Contents - Select

The Select panel within the Contents pane combines a number of functions related to selection into a single panel.  The Select panel allows making selections using pre-built templates or free form expressions.   It also allows us to save selections and to combine saved selections in Boolean combinations.tech_ravi_sm.png   The Select panel operates on tables, drawings, labels, images, and those components as layers in maps.  Templates involving fields for drawings and images will take those fields from the source table.  

 

Important: As with any selection capability, to use the Select panel the table must have at least one btree index in the table. 

 

Please read the Selection topic before proceeding with this topic.    See the Select Templates topic for a list and description of Select panel templates.

 

dlg_choose_select_panel.png

 

Open the Select panel in the Contents pane by pulling down the panel menu and choosing Select.   A keyboard shortcut of Ctrl+4 also switches the Contents pane to the Select panel.

 

To make selections using the Select panel:

 

  1. Open the component (table, drawing, labels, image, map).

  2. Click on the Contents pane and then click on the Select panel.

  3. Using a template, expression or a saved selection, put together a proposed selection.  

  4. That proposed selection will be previewed in the window using blue preview color.

  5. Choose how the selection will be combined with any previously existing selection by choosing a mode in the pull down menu for the command button.

  6. Press the command button, or to launch an equivalent query press the Edit Query button.

 

Command Button

A command button at the bottom of the Select panel specifies how the selection the panel creates should be applied to any existing selection in the table window.   By default the command button is set to Replace Selection.  

 

il_select_dlg_command_button.png

 

The pull-down menu allows us to choose other selection modes for the command button.   See the discussion below for more detailed information on selection modes in the command button.

Example

eg_select_panel01_01.png

 

We begin with our example drawing of Mexico, showing provinces in Mexico as areas.   The table for this drawing has attributes with data for each province, including a field called Place_name that gives the name of each province.  

 

With the focus on the opened Mexico drawing, click on the Contents pane and then click on the Select panel.   Illustrations in this topic show the Select panel in different sizes.  Like any undocked pane in Manifold, it can be resized as we like.

 

eg_select_panel01_02.png

 

In the Select panel Template tab, click on the Text Contains template and for the Value choose the Place_name field from the list.    Enter 'Durango' in the Search for box.

 

eg_select_panel01_03.png

 

The Select panel will immediately preview the selection to be made in the drawing using blue preview color.    Press the Replace Selection command button to apply that selection.

 

eg_select_panel01_04.png

When we press the Replace Selection button the province of Durango is selected in the drawing, and is shown in red selection color.

Open the Drawing's Table

We now open the drawing's table, Mexico Table.

 

eg_select_panel01_05.png

 

Since selections are shared between every component that depends upon the same table, the table already has the Durango record selected.    With the focus on the table window the Select panel automatically switches context to operating on that table window.  

 

eg_select_panel01_06.png

 

We click on the Text Starts with template, also using Place_name for the Value, and we enter 'S' in the Search for box.   This will select all records where the Place_name value begins with a capital S.  The template is case sensitive when searching for text strings.

 

eg_select_panel01_07.png

 

Right away, the template previews in blue preview color those records that would be selected by the template using those settings.    Previews are shown only in the window that has the focus, so areas in the drawing will not also be previewed.

 

eg_select_panel01_08.png

 

To add these to the existing selection we switch the command button to Add to Selection and then we press the Add to Selection button.

 

eg_select_panel01_09.png

 

The previewed records have been added to the selection and all selected records are now shown in red selection color.

 

eg_select_panel01_10.png

 

The areas corresponding to those selected records are also selected in the drawing, and also shown in red selection color.

 

See the Labels topic for a similar example using labels and the Select panel.

Select Panel Tabs

The Select panel operates on whatever layer or window has the focus.

 

il_select_dlg_tabs.png

 

The Select panel has three tabs:

 

Template Tab

The Template tab provides a list of pre-built selection commands, called templates.  Clicking on a template will highlight it and will open combo boxes for parameters that allow us to choose fields, to specify values, and to write expressions we would like to use for that template.    The templates list will automatically adapt to whatever is the context component, such as a drawing or image or other component.   

 

See the Select Templates topic for a list and description of Select panel templates.

 

il_seldlg_template_green_labels.png

 

To make selections using the Template tab:

 

  1. Open a drawing or a table.

  2. Click on the Contents pane and then click on the Select panel.

  3. Click on the Template tab in the Select panel if not already open.

  4. Click on the name of a template in the list to highlight it.

  5. In the Value box, choose the name of the field to use.

  6. For other boxes, choose another field to use as the argument or enter a number or text for the command to use.

  7. The panel will preview that selection in the drawing or table in blue preview color.

  8. Apply the previewed selection to the table by clicking the command button in the desired mode.

 

 

Template / Expression / Saved Tabs

Choose between pre-built templates, or writing a free-form SQL expression, or saving or using a selection.

Filter

Enter text to be matched, case not significant.  Allows us to reduce the long list of templates to show only those which contain the text entered in the Filter box.    For example, entering Geo in the Filter box in the above illustration, for example, will reduce the list of templates to only Geoms with Curves and Geoms with Z.   

Templates

A list of templates that can be used with the context component and the data type of the given target field.  Template icons show the effect of their action:

 

i_icon_template_row.png

 A record icon indicates the template operates on one record.  Such templates offer both Update Field and Add Component actions.

 

i_icon_template_table.png

A table icon indicates the template operates on a table, adding or deleting records.  Such templates offer Add Component only.

Parameters

Many templates take a source, or Value field from which they take the values upon which they operate. Some use an Overlay that is the name of another layer in the map.  Templates may open up additional combo boxes to allow us to enter additional fields or parameters the template needs for its work.  For example, the Between template opens up Lower bound and Upper bound boxes to allow those parameters to be specified.

Allow parallel execution

If checked (default) the template will allow execution using CPU parallelism in multiple threads with as many CPU cores as are available, providing faster performance.   Checking this box is equivalent to commanding THREADS SystemCpuCount() in SQL within templates.  Leave this checked.

Command Button

Choose settings by pulling down on the down arrow button.  Press the button to alter the selection as specified.   Record is a synonym for object.

 

  • Replace Selection - Select all records chosen by the template and deselect all other records.   This operation takes whatever records would be selected by the template and makes those the only records selected, ignoring anything before.

 

  • Add to Selection - Select all records that were previously selected plus in addition select all records that the template chooses.  Any records that were previously selected will, of course, remain selected.  If there was no prior selection, Add to Selection is equivalent to Replace Selection: in both cases the result is what the template would select.

 

  • Intersect with Selection - Select only those records that were previously selected and which also are chosen by the template.   If there was no prior selection the result would be to select no records.

 

  • Invert with Selection - An "anti-intersect" operation: everything except the intersection.  Select all records previously selected and all records which also are chosen by the template, except those records which were previously selected and also are chosen by the template.   This is equivalent to an Add to Selection that simultaneously de-selects any Intersect with Selection records.   If there was no prior selection the result of an Invert with Selection is equivalent to both Add to Selection and to Replace Selection since in all three cases the result is what the template chooses.

 

  • Subtract from Selection - De-select all records that are chosen by the template.  If there was no prior selection this is the same as selecting no records, that is Edit - Select None in the main menu.

 

Edit Query

Click to open the Command Window pre-loaded with an SQL query which accomplishes what the template does given all specified settings.

 

Combo Boxes

A combo box is computer jargon for a box like those used to choose the Value parameter.  It is called a combo box because it allows a combination of different ways to specify the value entered into the box.

 

Choose a field from a pull down list of available fields

il_combo_box_list.png

 

il_combo_box_field.png

Enter a literal value

il_combo_box_string.png

 

When we enter a literal value we must use SQL style to specify the literal value.  For example, if the field we are using is a text type, such as nvarchar, we must enter the desired text within single ' quote characters as seen above.

Enter an SQL Expression

il_combo_box_expression.png

 

Yes, this is truly cool, a small but seriously intense detail in Manifold.  The above expression takes the contents of the Date field, extracts the day of the month as a number and casts it into text form so it can be used within a text field.

 

Combo boxes generally come pre-loaded with a pull down list of fields in the table and by default contain the name of the first field in the table by alphabetical order.  This makes it easy to choose any field in the table to use with a template without having to keyboard the name of the field.  Combo boxes also generally allow us to manually enter a specific value, such as a field name or a number, or to enter an expression written using SQL syntax.

 

Many templates open a Value combo box that allows us to specify the name of a field in the table with which the template works.   The Is not Null and Is Null templates open only the Value combo box while other templates will open additional combo boxes to specify other parameters the template requires.

 

For example, the Equal template will open a Value and Compare to combo boxes. We choose the field name in the Value box and then in the Compare to combo box we can either choose the name of a different field or enter a fixed number.

 

Consider a table of products adapted from the ubiquitous nwind sample database.

 

eg_seldlg_template01_01.png

 

To select records where the Stock is Equal to the Units On Order we launch the Select panel and click on the Equal template. In the Value box we choose the Stock field from the pull down list of fields and in the Compare to box we choose the Units on Order field.

 

eg_seldlg_template01_02.png

 

We can enter numbers into the combo boxes as well.  If we want to select all records where the Stock field is 15 we enter the number 15 into the Compare to box.

 

eg_seldlg_template01_02a.png

 

Expressions written using SQL syntax will work with most templates.   For example, in the above we find all records with Units On Order values that are Greater than Stock * 3.   We do not need square brackets around the Stock field because it has no spaces in the field name.  When writing expressions using field names with spaces, it is better to get in the habit of using square brackets, as in [Units On Order].

 

 

eg_seldlg_template01_03.png

 

We can enter text strings into the combo boxes.   If we want to select all records where the Name field is Dharamsala Tea we choose the Name field in the Value box and then enter 'Dharamsala Tea' into the Compare to box.   Note that the text string is within single quote ' characters.

 

The Text Contains, Text Ends with and Text Starts with templates also come in Intl or international versions that provide a Language combo box used to choose a collation supported by Manifold.  The Intl forms of those templates also provide checkboxes to Ignore case, Ignore accent and Ignore symbols.   Those options can be very useful in languages where sometimes accents and symbols are used and sometimes not.   

 

For example, it is very common in French to encounter place names which in their official forms may use accents but which in technical uses such as databases do not.  The town of Vendôme in the Loir-et-Cher department of France, for example, is properly spelled with a circumflex accent (the small chevron mark) over the letter o. Nonetheless the name of the town is frequently spelled Vendome without a circumflex accent on web sites and in numerous address databases and other usages, both in France as well as internationally.   To select both Vendôme and Vendome we would check the Ignore accent box for templates that offer it.

 

The Like template utilizes the LIKE operator in SQL to match given patterns while the Text Matches Regexp allows us to specify a regular expression as the pattern to be matched.

 

Note that even though combo boxes for templates allow us to enter a numeric value instead of choosing a field does not mean that it makes sense to do so for all templates.

 

For example, the Is NULL template is used to select all records that have a NULL value.  If we click on the Is Null template a Value combo box opens up, pre-loaded with the name of the first field in the table by alphabetical order.   We can choose the name of any field in the table from the pull-down list of fields available in the Value box and the panel will preview a selection consisting of all records for which that field contains a NULL value.

 

Because combo boxes allow us to enter a number as well, instead of choosing a field name in the Value combo box for Is Null we could have entered a number such as the number 3.  That is possible but it doesn't make sense to do so, since in that case we would be asking the Select panel to select all records for which the number 3 is NULL.   A constant number like 3, of course, is never NULL so the panel would select no records.  tech_lars_sm.png

 

Important: When using the template Text Matches Regexp we enter a regular expression as a string into the Pattern box, surrounded by single quote ' characters and with any backslash \  characters within the regular expression escaped by a backslash character prefix for each, as in \\.   See the discussion and examples in the Regular Expressions topic.

Expression Tab

Clicking the Expression tab in the Select panel allows us to make selections with the panel based on SQL expressions that we can build with assistance similar to the Query Builder in the Command Window for SQL.

 

il_seldlg_expression_green_labels.png

 

The Expression tab provides three panes within the panel: an upper pane in which we can write expressions, a middle pane that shows fields in the table and a lower pane that shows operators and functions we can use.  Just as with the query builder in the Command Window, double-clicking on a field or an operator or function will add it to the expression we are building.

 

To make selections using the Expression tab:

 

  1. Open a table in a table window.

  2. Click on the Contents pane and then click on the Select panel.

  3. Click on the Expression tab in the Select panel.

  4. Double-click on the names of operators or functions to add them to the expression.

  5. Highlight arguments or other elements of the expression being built and double-click on fields in the field list to add them to the expression.

  6. The panel will preview the selection made by that expression in the table in blue preview color.

  7. Apply the previewed selection to the table by clicking the command button in the desired mode.

 

 

Template / Expression / Saved Tabs

Choose between pre-built templates, or writing a free-form SQL expression, or saving or using a selection.

Expression

Write an SQL expression into this pane, either manually or assisted by the expression builder by double-clicking onto fields or operators/functions in the other panes to add them to the expression.

Fields

A list of fields and their types from the table used by the component that is the subject of the Select panel.

Filter

Enter text to be matched, case not significant.  Allows us to reduce the long list of operators and functions to show only those which contain the text entered in the Filter box.  For example, entering null reduces the list to only those items that have NULL in their names.

Operators and Functions

A list of operators and functions that may be used in the expression.

Allow parallel execution

If checked (default) the template will allow execution using CPU parallelism in multiple threads with as many CPU cores as are available, providing faster performance.   Checking this box is equivalent to commanding THREADS SystemCpuCount() in SQL within templates.  Leave this checked.

Command Button

Choose settings by pulling down on the down arrow button.  Press the button to alter the selection as specified.   Record is a synonym for object.

 

  • Replace Selection - Select all records chosen by the template and deselect all other records.   This operation takes whatever records would be selected by the template and makes those the only records selected, ignoring anything before.

 

  • Add to Selection - Select all records that were previously selected plus in addition select all records that the template chooses.  Any records that were previously selected will, of course, remain selected.  If there was no prior selection, Add to Selection is equivalent to Replace Selection: in both cases the result is what the template would select.

 

  • Intersect with Selection - Select only those records that were previously selected and which also are chosen by the template.   If there was no prior selection the result would be to select no records.

 

  • Invert with Selection - An "anti-intersect" operation: everything except the intersection.  Select all records previously selected and all records which also are chosen by the template, except those records which were previously selected and also are chosen by the template.   This is equivalent to an Add to Selection that simultaneously de-selects any Intersect with Selection records.   If there was no prior selection the result of an Invert with Selection is equivalent to both Add to Selection and to Replace Selection since in all three cases the result is what the template chooses.

 

  • Subtract from Selection - De-select all records that are chosen by the template.  If there was no prior selection this is the same as selecting no records, that is Edit - Select None in the main menu.

 

Edit Query

Click to open the Command Window pre-loaded with an SQL query which accomplishes what the template does given all specified settings.

 

Example

If we want to use the StringContains function in an expression we can find it quickly by entering StringCon into the filter box.   That reduces the number of operators and functions to only those which contain that text.  

 

eg_seldlg_expression01_01.png

 

We double-click on the StringContains function to add it to the expression pane.  

 

eg_seldlg_expression01_02.png

 

We then highlight the <string> part of the function syntax and double-click on the [Name] field to replace <string> with [Name].  We could have manually keyboarded "[Name]" into the expression but double-clicking is faster even with short field names.  Avoiding typographical errors is another plus.  Typographical errors are not a major risk with short field names such as [Name] but when field names are long or difficult to keyboard we can save much time and avoid many errors by double-clicking the field name to enter it into an expression.

 

 

eg_seldlg_expression01_03.png

 

We then highlight the <substring> part of the function syntax and then add the substring we would like to match within single quote ' characters.  

 

If we do this by first adding two single quote characters, that is, beginning with an empty string and start writing the string we can see how the panel will dynamically begin previewing in blue preview color the selection it would make.   

 

eg_seldlg_expression01_04.png

 

For example, if we want to find all products in our example table that include the substring Beer in their names we can begin by writing 'B' in the substring section of the function and the panel will preview all products that have a capital B in their name.

 

eg_seldlg_expression01_05.png

 

As we continue to write the word Beer to enter 'Be' the preview will indicate fewer products.

 

eg_seldlg_expression01_06.png

 

When we finish writing the word the preview indicates just one product.  We can, of course, write expressions of arbitrary complexity using any combination desired of fields, mathematical and other operators, functions and so on.

 

Important: When using functions involving regular expressions we pass the regular expression as a string argument to the function, surrounded by single quote ' characters and with any backslash \ characters within the regular expression escaped by a backslash character prefix for each, as in \\.   See the discussion and examples in the Regular Expressions topic.

Saved Tab

The Saved tab in the Select panel allows us to save selections made in a table, drawing, image or layer in a map, so the saved selection will persist even if the window is closed, if the Select panel is closed and even if the project is closed.   

 

il_seldlg_saved_green_labels.png

 

Click on a saved selection and it will be previewed in blue preview color.  Ctrl-click on a saved selection to select it and the toolbar buttons will be enabled, allowing us to update the saved selection or to delete it.

 

 

Adding a saved selection to the Saved tab:

 

  1. Open a component, such as a table, drawing, layer, in a window.  Make a selection.

  2. Click on the Contents pane and then click on the Select panel.

  3. Click on the Saved tab in the Select panel.

  4. Double-click into the cell to the right of the asterisk * new item row handle to open the cell for editing.

  5. Enter a name for the new field in the text box and press Enter.

  6. The selection will be saved, and a new boolean field of that name will be added to the table with true values for the selected records.

 

Using a saved selection:

 

  1. Open a component, such as a table, drawing, layer, in a window.

  2. Click on the Contents pane and then click on the Select panel.

  3. Click on the Saved tab in the Select panel.

  4. Click on the name of a saved selection in the list.

  5. The saved selection will be previewed in the window in blue preview color.

  6. Apply the previewed selection by clicking the command button in the desired mode.

 

Updating a saved selection:

 

  1. Open a component, such as a table, drawing, layer, in a window.  Make a selection.

  2. Click on the Contents pane and then click on the Select panel.

  3. Click on the Saved tab in the Select panel.

  4. Ctrl-click on the name of a saved selection in the list to select it.  The toolbar will be enabled.

  5. Click the Capture button.

  6. The saved selection field will be updated to save the current selection in the window.

 

Note:  More than one of the saved selections can be selected within the panel by Ctrl-clicking each.   The Capture button will update each of them to contain the selection in the table.

 

To delete an existing saved selection in the Saved tab:

 

  1. Open a component, such as a table, drawing, layer, in a window.

  2. Click on the Contents pane and then click on the Select panel.

  3. Click on the Saved tab in the Select panel.

  4. Ctrl-click on the name of a saved selection to select that saved selection.  It will be shown in red selection color.

  5. Press the Delete button in the toolbar or the Delete key on the keyboard to delete that saved selection.

 

Note:  More than one of the saved selections can be selected within the panel by Ctrl-clicking each.   The Delete button will delete all of the selected saved selections.

 

Template / Expression / Saved Tabs

Choose between pre-built templates, or writing a free-form SQL expression, or saving or using a selection.

btn_capture_saved_selection.png

Capture button - Enabled when one or more of the saved selections has been selected.   When pressed, updates all selected saved selections with whatever is the current selection in the table.

btn_delete_saved_selection.png

Delete button - Enabled when one or more of the saved  selections has been selected.   When pressed, deletes all selected saved selections.

Saved Selections

A list of all of the saved selections in the table.  A saved selection is simply a Boolean field set to true or false.  The saved selections list thus shows all Boolean fields in the table.   If the table contains Boolean fields that are not saved selections in addition to the Boolean fields that are intended for use as saved selections, it is a good idea to name the saved selections using some standard pattern, such as Anton Selection.  

Allow parallel execution

If checked (default) the template will allow execution using CPU parallelism in multiple threads with as many CPU cores as are available, providing faster performance.   Checking this box is equivalent to commanding THREADS SystemCpuCount() in SQL within templates.  Leave this checked.

Command Button

Choose settings by pulling down on the down arrow button.  Press the button to alter the selection as specified.   Record is a synonym for object.

 

  • Replace Selection - Select all records chosen by the template and deselect all other records.   This operation takes whatever records would be selected by the template and makes those the only records selected, ignoring anything before.

 

  • Add to Selection - Select all records that were previously selected plus in addition select all records that the template chooses.  Any records that were previously selected will, of course, remain selected.  If there was no prior selection, Add to Selection is equivalent to Replace Selection: in both cases the result is what the template would select.

 

  • Intersect with Selection - Select only those records that were previously selected and which also are chosen by the template.   If there was no prior selection the result would be to select no records.

 

  • Invert with Selection - An "anti-intersect" operation: everything except the intersection.  Select all records previously selected and all records which also are chosen by the template, except those records which were previously selected and also are chosen by the template.   This is equivalent to an Add to Selection that simultaneously de-selects any Intersect with Selection records.   If there was no prior selection the result of an Invert with Selection is equivalent to both Add to Selection and to Replace Selection since in all three cases the result is what the template chooses.

 

  • Subtract from Selection - De-select all records that are chosen by the template.  If there was no prior selection this is the same as selecting no records, that is Edit - Select None in the main menu.

 

Edit Query

Click to open the Command Window pre-loaded with an SQL query which accomplishes what the template does given all specified settings.

Example

eg_seldlg_saved02_04.png

 

For example, in the illustration above we have two saved selections in the Saved tab that we have saved previously.  If we click on the Anton saved selection the records which are part of that selection will be previewed in the table.   We can click on the Replace Selection command button to select the previewed records.

Saved Selections Change the Table Schema

Selections are saved by adding a new boolean field to the component's table that captures the selected / not selected status of a record.   The value in the field for selected records will be 1 or TRUE.  The value in the field for unselected records will be 0 or FALSE.

 

Important: Using the Saved tab to save a selection will alter the schema of the component's table by adding a new boolean field to the table.  

 

That is something to keep in mind if the table with which we are working is located within a data source where other people might also be using it, in case those other people may be surprised to see the table's schema change.

 

We can add as many saved selections as we want, with a new boolean field being created in the component's table for each.  Manifold applies no limit to the number of saved selections, although obviously a list of very many saved selections in the Saved tab may be cumbersome to navigate.

 

When opened the Saved tab shows a list of all saved selection fields as well as all other boolean fields in the table.  The last row in the list is a blank row with an * asterisk character in the row handle to allow us to add saved selections.  

 

We can use an existing saved selection by clicking on the field name to highlight it in the Saved list.  The selection will then be previewed in blue preview color in the table.   We can combine that saved selection with any current selection in the table by using the Select panel's command button for replace, add, intersect, invert or subtract combinations.

 

Because saved selections are saved by adding a field to the table those saved selections will persist even if we close the table.   When we re-open the table the added field will still be in the table and the Select panel's Saved tab will once again show it. If the table is stored within the project and we save the .map file for the project, the fields added to a table to save selections will still be there when we next open the .map file, even if we move the .map file to a different computer.

Saved Selections Show All Boolean Fields

There is nothing magical about fields the Saved tab creates to save the selected status of records.  Such fields are simply boolean type fields just like any other boolean field.  If our table has any existing boolean fields in it when we open the Select panel the Saved tab will show those in the Saved list as well, as if they are saved selections.   That has the side effect of enabling us to rapidly make a selection on the basis of any boolean field that already exists in the table.

 

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 a saved selection boolean field, such as the Anton field in the example below 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 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 highlight them in the Saved tab and press the Delete button, which removes that field from the table.

Tables Must be Writable for Saved Selections

To save selections the component's table must be writable.  If it is a read-only table Manifold will not be able to create a new boolean field in the table for the saved selection.   

 

Because saved selections are nothing more than an additional boolean field, we can save selections for any table that allows us to create a boolean field in it, even if the table is hosted in some data source external to the project, such as an Oracle or PostgreSQL database.

Example

We open the Products table for the example nwind database and we select two products.

 

eg_seldlg_saved02_01.png

 

In the Select panel we click on the Saved tab and we double-click into the blank cell next to the * asterisk row handle.

 

eg_seldlg_saved02_02.png

 

We enter a name for the saved selection.   The name must be a legal field name in whatever data source stores the table, since the boolean saved selection field that will be added to the table will use that same name.   Press Enter when finished keyboarding the name.   A new saved selection called Anton appears.

 

Next we deselect the two records and select three other records.   To create a second saved selection we double-click into the next blank cell.

 

eg_seldlg_saved02_03.png

 

We enter the name Asian for this saved selection and press Enter.   We now have two saved selections.

 

To use the saved selections we can click on whichever one we want.   To demonstrate, first we choose Edit - Select None to clear the selection in the table.  

 

eg_seldlg_saved02_05.png

 

If we click on the Asian saved selection the panel will preview the three records that are in that saved selection.

 

eg_seldlg_saved02_04.png

 

If we click on the Anton saved selection the panel will preview the two records that are in that saved selection.   

 

il_select_saved_replace_command.png

 

To select those records we press the Replace Selection command button.

 

eg_seldlg_saved02_06.png

 

Suppose now we click on the Asian saved selection.   That saved selection will be previewed in the table.

 

il_select_saved_add_command.png

 

To add those previewed records to the selection we switch the command button to Add to Selection and press the command button.

 

eg_seldlg_saved02_07.png

 

That adds the previewed records to the selection, and switches the panel to the Template tab.

Updating a Saved Selection with Capture

To update a saved selection with a new selection, we make the desired selection, Ctrl-click on the saved selection to be updated and then press the Capture button in the toolbar.

 

Suppose in the nwind sample database scenario we learn that the same company, Anton International, markets products under the Grandma's and Uncle Bob's brands as well as the Chef Anton's brand.    We therefore would like to update the saved selection called Anton so that it selects products for all three of those brands.

 

We begin by selecting the Chef Anton's, Grandma's and Uncle Bob's products.   

 

eg_seldlg_saved02_08.png

 

We then Ctrl-click the Anton saved selection to select it.  That enables the toolbar buttons.   Since the Chef Anton's products were already selected, the combination of red selection color and blue preview color applied by clicking the Anton saved selection results in a blended color for those records.

 

We can then press the Capture button, which updates the Anton saved selection with whatever is the current selection in the table.  

 

eg_seldlg_saved02_09.png

 

If we now press the updated Anton saved selection it will preview the records it will select, which are records for Chef Anton's, Grandma's and Uncle Bob's brand products.

Command Button Selection Modes

The Select panel provides a command button at the bottom of the panel that specifies how the selection it creates will be applied in combination with any selection that already may exist in the subject window.   

 

il_select_dlg_command_button.png

 

We choose a selection mode from the pull-down menu and then the command button will use that mode.   The selection mode we choose from the menu will persist until we choose a different mode for the command button.   The available selection modes available are listed below with a Venn diagram showing how the different command button modes operate.

 

In the Venn diagrams the left-hand circle represents the existing selection in the table and a second, overlapping circle represents the selection that the Select panel would make.  Just as for selections in windows, the existing selection circle is shown in red selection color.  The selection the panel would make is shown in blue preview color. The overlap, that is, those records that are both in the existing selection and which are also are in the preview are shown in blended color that combines the red selection color with blue preview color.  The final result of pressing the Select panel command button in the given mode is shown entirely in red selection color.

 

il_sel_replace.png

Replace Selection -  Select all records chosen by the template and deselect all other records.   This operation takes whatever records would be selected by the template and makes those the only records selected, ignoring anything before.

 

 

il_sel_add.png

Add to Selection -  Select all records that were previously selected plus in addition select all records that the template chooses.  Any records that were previously selected will, of course, remain selected.  If there was no prior selection, Add to Selection is equivalent to Replace Selection: in both cases the result is what the template would select.

 

il_sel_intersect.png

Intersect with Selection - Select only those records that were previously selected and which also are chosen by the template.   If there was no prior selection the result would be to select no records.

 

il_sel_invert.png

Invert with Selection -  An "anti-intersect" operation: everything except the intersection.  Select all records previously selected and all records which also are chosen by the template, except those records which were previously selected and also are chosen by the template.   This is equivalent to an Add to Selection that simultaneously de-selects any Intersect with Selection records.   If there was no prior selection the result of an Invert with Selection is equivalent to both Add to Selection and to Replace Selection since in all three cases the result is what the template chooses.

 

il_sel_subtract.png

Subtract from Selection - De-select all records that are chosen by the template.  If there was no prior selection this is the same as selecting no records, that is Edit - Select None in the main menu.

 

Note that since other commands remain fully operational when the Select panel is open we can still use menu commands such as Edit - Select All, Edit - Select None and Edit - Select Inverse.  We can use mouse selection methods as well.   Between those commands and the rich set of selection capabilities provided by the Select panel we can make exactly the selection we want.

Dynamic Updating

The Select panel dynamically updates itself given any changes in the table's schema.  For example, if we choose Edit - Schema and then add a new boolean field to the table the available fields in the Expression tab's expression builder will be updated with the new field and the new boolean field will also appear in the Saved tab as a saved selection.    If we delete all btree indexes from the table the Select panel will automatically be disabled, since it cannot work with tables that do not have at least one btree index.

Simultaneous Use of Other Facilities

When we have the focus on an open window the Select panel works with that particular window.  At the same time we can open other windows and do other work with Manifold, going back and forth between the other work and the Select panel.  The Select panel will automatically switch context to apply to whatever open window has the focus.

Selection Colors

Selection color by default is red: records in tables with a light red background or objects in drawings rendered in red are selected.

 

Preview color by default is blue. The Select panel will preview what records would be selected if the current expression is used by showing those records with blue background.   In drawing windows, objects in the process of being edited or which are in some sort of not-yet-committed selection process are also previewed in blue preview color.

 

Selections in tables will often encounter a situation where some records have already been selected in red color but in addition some records are being previewed in blue color as part of a selection process underway.     In cases where the same record is already selected in red color but also the system wants to show that it would be selected by the process underway by rendering it in blue, the resulting color is a blend of red and blue.   

 

This effect might be confusing when a table is first seen with a mix of records shown in red, blue, blended violet and white backgrounds. New users might look at that blended color and think "Hmm... looks blue to me..." but the more experienced user will rapidly learn to recognize it as a blend between red and blue that indicates a selected record which also is being previewed.  The blended color instantly indicates the intersection of the existing selection and what the previewed action would select.

 

That is also an effect to keep in mind right after we apply a selection action in the Select panel, when just after we apply the command, say, by pressing the Replace Selection command button, instead of seeing the previewed records in the table turn from blue to red they all appear in blended color.  What is going on is that until we move on in our workflow since the Select panel is still set to whatever action that made that selection it is still previewing the effect of that action in blue.  When we apply that action to select those records they immediately become both selected and also will still be previewed, resulting in the blended color.   The moment we move on to doing something else in the Select panel, say, by changing the expression or by clicking on a different template or tab, the blue color preview overlay, if any, will change or go away and we will see the selected records  in red selection color.

 

The above color effects merit close attention by new users: experienced users rely on them as essential visual cues while beginners who do not learn the basics often find them confusing. If we spend a few minutes getting our heads around what colors convey we can use those visual cues for more rapid, error-free and effective selections, especially when combining selections.

 

Notes

Allow parallel execution - If checked (default) the template will allow execution using CPU parallelism in multiple threads with as many CPU cores as are available, providing faster performance.   Checking this box is equivalent to commanding THREADS SystemCpuCount() in SQL within templates.  The only reason to uncheck this box is in very rare cases when we do not want Manifold to utilize all CPU cores in parallel.   For example, if we want to do a geometric selection such as Geoms Containing on a very large and complex data set while also doing work in some other program where the speed of the other program is more important.  In such cases we might turn off parallel execution by Manifold so some cores are left available to power other work we are doing, even if that results in the selection taking longer.

 

Select mode ignored - Queries generated by the Edit Query button in the Select pane ignore the select mode specified by the Command button.  The purpose of the query generated by the Edit Query in the Select pane is to show what the system does to apply a specific template and to produce a reasonable starting point for customizing the query further. The code for combining the output of the template detracts from that.   Saved selections, in any event, are often a better way of combining multiple selections.

 

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 will often take a moment to use the Layers panel to hide the mfd_id field and to hide other fields in the table window that are not being used or are not central to the example.  We also frequently show panels overlapping the table windows.  There is no requirement to overlap a table window with a panel for that table window but 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

Contents Pane

 

Select Templates

 

Tables

 

Selection

 

Drawings

 

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

 

Example:  Using the Select Panel Saved Tab - How to save selections and then use them later.

 

Example: Construct JSON String using Select and Transform - Use the  Select and Transform panels 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.