Maptitude GISDK Help

ExportView()

Summary

Exports the contents of a view to a new table.

 

Changes

Row Order option added in Version 2013. Return value and MEM class added in Version 2015. ExcelX and MSSQLD classes added in Version 2016. Additional Fields array updated in Version 2018.

 

Syntax

new_view_name = ExportView(string view_set_name, string class, string file_name, array field_names, array options)

 

Argument

Contents

view_set_name

The name of the view and selection set, separated by a vertical bar

class

Class of new table to create ("dBASE"," FFA"," FFB", "CSV", "EXCEL", "EXCELX", "MSSQLD", or " MEM")

file_name

File name for the new table, the spec for a "MSSQLD" table, or the proposed view name for a "MEM" table

field_names

The list of fields to store in the new table, or null to store all fields in the new table

 

Option

Type

Contents

Additional Fields

Array

An array that contains one array element for each additional field to append to the new file. Each array element has the format {name, type, width, decimals, internal_index_flag, description, format}. For more information, see CreateTable().

CSV Drop Quotes

Boolean

If "True" when exporting to a comma-separated file, do not have quotes around string field values in the exported file (default is "False").

CSV Header

Boolean

If "True" when exporting to a comma-separated file, the first line of the file contains field names, and data starts at the second line (default is "False").

Dictionary Description

String

A description to be stored in the first line of the resulting FFA, FFB, or CSV dictionary file.

Force Numeric Type

String

Type should be chosen from "double", "float", "integer", "long", "real", or "short". All numeric fields will be exported using the specified type whenever allowed by the underlying database that is being exported to.

Indexed Fields

Array

A list of fields to be internally indexed in the new table.

Unique Fields

2 arrays

An array of field names, and an array indicating a sort order. If several records in the view have identical values for all the indicated fields, only one will be exported. The sort order (if it is not null) indicates which record to export. The format of the sort order is identical to that used in GetNextRecord().

Secondary

Array

For MSSQLD, an options array with values for "Table" (the table name) and "Schema" (the schema name); see the second example.

Row Order

Array

An array that indicates the desired sort order, or null for natural order. The array is an array of field name-order pairs:

 

Element

Type

Contents

1

String

The name of the field

2

String

"Ascending" or "Descending"

 

Returns

A string containing the name of the view, when a MEM table is created, otherwise null.

 

Notes

Example

ExportView("Customers|Top Ten", "CSV", "topten.csv",

     {"Name", "Address", "Sales", "SalesRep"},

     {

          {"CSV Header", "True"},

          {"Indexed Fields", {"Name", "Sales"}}

     })

 

 

// Replace with server name, instance name and database name

database_name = "server\instance|database"

opts = null

opts.Secondary.Table = "Table" // Replace with table name

opts.Secondary.Schema = "dbo"  // replace with schema name

ExportView("Customers|Top Ten", "MSSQLD", database_name,,opts)

 

Error Codes

Error Type

Meaning

Error

Unable to create the table (e.g., the file is currently in use, or disk space is insufficient)

Escape

The user clicked Cancel

NotFound

The view or set name is invalid

 

See Also

Function

Summary

CreateTable()

Creates an empty table and opens it as a view

ExportEditor()

Exports the contents of an editor to a new table

FileCheckUsage()

Checks whether files are in use by Maptitude

 

 

©2025 Caliper Corporation www.caliper.com