Style: Text Fields

This topic accompanies the Styling Table Fields topic to provide reference detail on styling fields in tables for text data types.  Please review the Styling Table Fields topic for an introduction and step by step examples before proceeding with this topic.

Text Styles

Styles for text fields, either nvarchar or varchar text types,  provide options to style the contents of the field as a command line, a path to a file, an email address, or as a URL.   A blue color, as with default URL styling in browsers, is used to show the values can be launched as commands, opened as files, used as email addresses, or launched as a hyperlink.    Styles apply both to table windows and to the Info pane.

 

 

(default)

Simple text:  quick brown fox

c

A valid Windows command line formatted in blue color, such as:

 

C:\9\manifold "C:\Projects\world.map"

 

Right-click into the cell and choose Run Command to launch the command in whatever is the default Windows application for that file type.

f

Absolute path to a file formatted in blue color, such as:

 

c:\pix\lincoln.png  

 

Right-click into the cell and choose Open File to launch the file in whatever is the default Windows application for that file type.

m

Format valid email strings as email addresses in blue color, such as:

 

sales@manifold.net

 

Right-click into the cell and choose Send Email to compose a new email message to that email address using the default email program.

u

Format valid URL strings as hyperlinks, such as:

 

https://manifold.net/  

 

Right-click into the cell and choose Open URL to launch the URL in the default browser.

 

Example: Use File style to Open Images

Styling text fields that contain absolute paths to files makes it easy to open those files from within either a table window or the Info pane.   Files can be anything that Windows can open using whatever are the default applications to open different file types.   A record can include a field that provides a .pdf file, a photographic image such as a .jpg or a .png file, a file that saves a Remote Desktop session, or even the path to a .map file to open in a new Manifold session.

 

 

Consider the table shown above, which has an nvarchar text field called Photo, which contains the name of a .png file that provides a photo for each person in our Contacts table.

 

Images/eg_style_table_fields_file01_01.png

 

Right-clicking on the Photo column head and choosing Style, and then choosing the file option will style the fields as filenames, using whatever is the current Windows color for hyperlinks (blue by default).  

 

Cells that contain text which is not in its entirety a valid path to a file name will not be styled as files.   

 

 

We can right-click on any of the Photo cells and choose Open File to open the photo file in whatever is the default Windows application to open image files like .png files.   For example, right-clicking on the second cell and choosing Open File will launch that .png file in the Windows Photo application:

 

 

The Photo field contains the absolute path to the photo image file.   That allows launching the file no matter what the relative locations of the project file that is opened and the folder where the photos are stored.

 

However, when importing or joining the names of photos into tables, it could be that only the names of the photo files are easily available.  In that case, it is a simple matter to prefix the path for the Windows folder where they are located, to create an absolute path that can be used to open the file.

 

 

For example, suppose we have a Photo File field that gives the name of each photo image file, perhaps as joined into the table from another table that provides the name of a photograph file for the name of each contact name.   We can create a field called Folder, which we can then fill with the path to the folder where the photo image files are stored.

 

Next, we use the Schema dialog to add a computed field called Photo.

 

 

The expression we use is [Folder] + [Photo File] which is a simple concatenation of the two text fields.

 

 

The concatenated result appears in the new Photo computed field, which we can style using the f for file option.    Another way to do the same thing would be to not use a Folder field, but instead to write the expression for the new computed field to concatenate the string c:\pix\ to the name of the photo image file.    However, using a Folder field allows us to use photos that are located in various folders, so with different paths to the various folders in the Folder field.

 

This example for styling of files uses photo image files, but we can apply the same technique to pop open any file type.   For example, we could have a drawing that shows the positions of different machines on a factory floor, and the drawing's table could have a Documentation field that contained the name of a .pdf file for each such machine that provides a user manual for each machine.   Alt-click a machine in the drawing to see fields for it in the Info pane, and then open the .pdf file for that machine to read about it.  

 

To take another example, we might have a drawing that shows the locations of our real estate assets in a country.    The drawing's table could have a variety of fields for each real estate asset, with fields providing a web, and perhaps a text field with the location of a .map file for each facility.  Use Open File to launch the .map file for a facility in Manifold, and that .map project could provide a vast amount of data for each facility, with drawings showing the layout of the facility, tables that provide access to documents and photos, and much more.

Example:  Launch Remote Desktop connections

If we use Microsoft Remote Desktop (RDP) to connect to many different computers we can use Manifold to keep track of our RDP connections in a table, and to easily launch an RDP connection from that table.  

 

Remote Desktop can save RDP connections as .rdp files.  When an .rdp file is double-clicked in Windows Explorer, Remote Desktop will automatically pop open and connect to the connection specified in that .rdp file.  We can use that to create Manifold projects that help us keep track of the RDP connections we use.  

 

To set up the project, we first launch RDP for each such connection and then we save the connection as an .rdp file using the Show Options button in the Remote Desktop Connection dialog.  In our Manifold project, we create a table that has a row for each computer to which we connect with a text field that contains a path to the .rdp file that connects to that computer.   We style that text field using the f for file style.

 

 

If we have an .rdp file that saves an RDP connection to a computer called archive in a file called archive.rdp, the path we might use for that connection might be:

 

  c:\rdpfiles\archive.rdp

 

To connect to one of the computers in the table, we right-click the RDP File cell for that computer and choose Open File.  The system will automatically launch that .rdp file for us in Remote Desktop to open an RDP session to that computer.   Super!

Example:  Send Email

Styling text fields that contain email addresses makes it easy to email them.  This facilitates use of email addresses in tables and maps in Manifold, where we might be using Manifold interactively to contact people associated with records or objects, such as facilities shown in maps.

 

 

Consider the table shown above, which has an nvarchar text field called Email, which provides an email address for each person in our Contacts table.

 

 

Right-clicking on the Email column head and choosing Style, and then choosing the email option will style the fields as email addresses, using whatever is the current Windows color for hyperlinks (blue by default).  

 

Cells that contain text which is not in its entirety an email address will not be styled as an email address.   The validation used to check if the text in a cell is a valid email address is permissive, only excluding text that certainly is not an email address.

 

 

We can right-click on any of the Email cells and choose Send Email to launch that email address in our default email client.     For example, right-clicking on the second cell and choosing Send Email will launch that email in our default email client as the To: address in a new email message, ready to compose as we like and to send.

 

 

The email style (as with other field styles) is also used in the Info pane. We can right-click an email-styled field in the Info pane and choose Send Email to launch it in our email client.

 

Note that having an email style in addition to a URL style is a convenience.  The email style is equivalent to creating a text field that prepends mailto: to each email address and then styling the text field as a URL.   For example, text in the form mailto:sales@manifold.net when styled using the URL style and launched using Open URL will also launch that email address in the To: field of a new message in our default email client.   The point of having an email style is making it easy to consume tables that have email addresses in them, without having to prepend mailto: to each email address to allow using them as a URL.

Example:  Launch a URL in a Browser

Styling text fields that contain URLs makes it easy to launch them in a browser.

 

 

Consider the table shown above, which has an nvarchar text field called URL_Overview, which provides a URL to a page that shows an overview diagram for the total eclipse of that date.

 

 

Right-clicking on the URL_Overview column head and choosing Style, and then choosing the URL option will style the fields as hyperlinks, using whatever is the current Windows color for hyperlinks (blue by default).  

 

 

We can right-click on any of the URL_Oveview cells and choose Open URL to launch the hyperlink in a browser window.   For example, right-clicking on the third cell and choosing Open URL will launch the hyperlink:

 

https://eclipse.gsfc.nasa.gov/SEplot/SEplot2001/SE2024Apr08T.GIF

 

which will display an overview diagram of the total eclipse of the sun for 8 April 2024.  Given typical weather patterns for early April, the best viewing with good international travel connections is likely to be in Texas near the border with Mexico.

 

 

The hyperlink style will only be applied to cells where the entire text value is a valid URL.   For example, in the illustration above we have altered the text in one of the cells to include the additional text My link: in front of the URL text.  Since the text My link:  https://eclipse.gsfc.nasa.gov/SEplot/SEplot2001/SE2027Aug02T.GIF is not a valid URL, the entire contents of the cell are shown in plain text style, not in hyperlink style.  

 

 

If we edit the cell to delete the extra My link: text, the cell will automatically be formatted as a hyperlink.

URL example with files

An alternative to using file styling to open a file in a program is to use URL styling to open a file in a program.  URLs can be used to launch programs to open files, using URL formats such as file:///c:/... to specify the file to be opened.  URLs for files will be opened by whatever is the default program for opening that type of file, such as, a PDF reader or browser to open .pdf files.

 

Important:  URLs use foward / slash characters, instead of Windows back \ slash characters to separate folders in the path hierarchy to a file.

 

 

Right-clicking on one of the cells in URL field in the table above and choosing Open URL will launch that URL in whatever program is configured in Windows to open .jpg files by default.  If no other program is set up to open .jpg files, our default browser will usually open them.  

 

The table shows example files that are .jpg format images, but launching a file: URL will launch any file type in a browser that the browser understands if the browser is set to open that file type by default.  For example, modern versions of Microsoft's Edge browser will open PDF files, Excel spreadsheets, and other Office documents.  That allows us to keep links to files in our Manifold projects, and to then open those files for viewing.

 

See Also

Styling Table Fields

 

Style: Binary, Boolean, UUID Fields

 

Style: Datetime Fields

 

Style: Geom, Tile Fields

 

Style: Numeric Fields

 

Styling Choices in Tables