Import via connection file

<< Click here to view the full document >>

Import >

Import via connection file

Connection files let you import data directly from databases and other sources accessible through ODBC or OLE DB. They can connect CutLogic 2D to an ERP, inventory, or production management system without first exporting the data to an intermediate file.

A connection file contains a connection string and, optionally, a table name or SQL query. Once connected, the retrieved data is loaded into the standard Import form for review and field mapping.

Creating a connection file

Create a plain text file in a text editor, such as Notepad, and save it with the .conn extension. Enter the connection settings required by your data source, such as the server, database, and login details.

The appropriate ODBC driver or OLE DB provider must be installed on the computer running CutLogic 2D. The connection settings depend on that driver or provider. Your IT administrator can help you prepare them.

The examples below use placeholder server names, database names, and login details. Replace them with the settings for your data source.

Selecting a source table

If the connection file contains only connection settings, CutLogic 2D prompts you to select a source table. For example, this standard connection string uses the Microsoft SQL Server OLE DB provider:

Provider=SQLOLEDB;Server=myServer;Database=myDatabase;

Uid=myUsername;Pwd=myPassword;

To select a table automatically, add TableName:

Provider=SQLOLEDB;Server=myServer;Database=myDatabase;

Uid=myUsername;Pwd=myPassword;TableName=Parts

Selecting data with SQL

Instead of specifying a table, you can add SQL= followed by a query. This lets you choose columns, filter records, sort the results, or combine related data from several tables. For example, the following connection file retrieves orders for one material, sorted by length:

Provider=SQLOLEDB;Server=myServer;Database=myDatabase;

Uid=myUsername;Pwd=myPassword;SQL=

select * from Parts

where MaterialNo = 321

order by Length

The following example uses an ODBC connection to a PostgreSQL database. It retrieves parts from released production orders, together with material, order, and customer information:

DRIVER={PostgreSQL Unicode};SERVER=myServer;PORT=5432;

DATABASE=myERP;UID=myUsername;PWD=myPassword;SQL=

select p.length_mm, p.width_mm, p.quantity, p.description,

      p.material_name, o.order_number, c.company_name

from production_parts p

join production_orders o on o.id = p.order_id

left join customers c on c.id = o.customer_id

where o.status = 'released'

order by o.order_number, p.id

The query's result columns become the source columns in the Import form. You can map them to target fields in the same way as columns from an Excel or CSV file.

Importing the data

Select the destination tab in CutLogic 2D, press Ctrl+I, and open the .conn file. Select a source table if prompted, then review the retrieved data, map the fields, and click Import.

You can reuse the connection file for subsequent imports. Each time you open it, CutLogic 2D retrieves the current data from the source. Import settings and field mappings are remembered for each destination tab.

For the shared import workflow and available options, see Import. For connection string examples for other data sources, visit www.connectionstrings.com, or contact us for assistance.