Support for Saved Queries in MWS (XML) Files - MapInfo_Pro - 2023

MapInfo Pro Help

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapInfo Pro
Version
2023
Language
English
Product name
MapInfo Pro
Title
MapInfo Pro Help
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:39:16.995549

You can write MapBasic SQL queries to a workspace file as MapInfo SQL language queries and add the map definitions based on those queries to an MWS file. In MWS they are saved as MapXtreme Views in a MapInfoSQLDataSourceDefinition element in the DataSourceDefinitionSet.

SQL queries, and the MWS map definition layers based on them, are written to the MWS if you select the option Save Queries in Workspace in the Startup dialog box (on the PRO tab, click Options, and Startup). Only queries referenced by a Map window will be written to the MWS.

To use this functionality:

  1. Select the Save Queries in Workspace option in the Startup dialog box (on the PRO tab, click Options, and Startup). If you do not select this check box and the map selected from the Select Mapper Windows dialog box has only one layer based on a query, the query is not saved, and a map definition with an empty layer list is written.
  2. Create and execute a SQL query.
Note: Only SQL statements can be saved to workspaces when they are created on the MAP tab, in the Selection group, by clicking SQL Select, opening the Select dialog box from the Selection group Launcher button, or created from MapBasic Select statements.
  1. Create a Map window based on your SQL query.
  2. On the HOME tab, in the File group, click Save Workspace and then select the MapInfo Workspace Format (*.mws) as the output format. MapInfo Pro cannot map selections with Group By, so Group By clauses are ignored. MapInfo Pro only translates the Order By clause.
Note: MapInfo Pro cannot support sub selects in queries. The operators Any and All are not supported in the MapXtreme 2004 or later versions of MapInfo SQL and subselects are not either.