Create Data Table from External File
Data plays an important part in your applications and LogicNets allows you to import tables using your existing data in the Comma-Separated Values (.csv) or Tab-Delimited (.txt) format. You can quickly upload and import your data to the resources/data subfolder of your project and access and use the data values as part of your project's modeled processes.
Prepare External File for Import
Before loading the information into LogicNets you need to perform a few checks to create the file for import:
- Review the column names. The system will use these to create table column names when loading your data.
- Ensure each column has a unique name in the first row of the data source.
- Convert column names to all lowercase text.
- Replace spaces in column names with the underscore character; for example, Product Code should be product_code.
- Review your data for errors, missing information, or carriage returns and other special characters that may interfere with the upload.
- Depending on the source program, some characters may be hidden from view and may cause the import process to fail. If your file fails or does not contain all of the data you expected, you can repeat the upload after correcting the errors.
- Save your source document in either the .csv or tab-delimited .txt format. Both options are available in the Save As menu in Microsoft Excel and other spreadsheet programs.
- If your information is text-based and resides in tables in Microsoft Word or similar programs, copy and paste the data into a spreadsheet program first.
Load and Verify Data
Take the following steps to load the data into the LogicNets Designer.
- Open your project and navigate to the resources/data folder.
- Select the Import Table icon.
- Enter your table name in the Table name field. Type in your desired table name lowercase and uppercase letters, numbers, and underscores are allowed in the name field. Spaces are not allowed.
- Click Choose File, locate the csv/txt file on your local drive, and click Open.
- Click on Upload to upload your file.
- If there are no errors, the system loads the data and opens the table.
- Verify the data was loaded successfully. If there are errors you can do one of the following:
- delete the table, correct them in the source file, and repeat the steps above,
- use the buttons above the data list to make the edits directly in the table in the Designer.
- Verify that the system has correctly assigned the data type to each column by clicking on the modify button. The system displays a view of the table structure and you can correct any column definition errors here, including column name and type. You can also add captions to the column and add or remove columns. To do this from this screen use the Mode dropdown menu to select Add/Delete Columns.
Tips and Tricks
Watch out when using Microsoft Excel to create a TAB separated .txt file from a spreadsheet. If the first few records don’t have values for all fields, Microsoft’s engine will strangely add a SPACE on either side of the column name. (This has been reported by CL users on the internet and may be a defect or undocumented functionality). This typically goes unnoticed unless you use a Text Editor that highlights the various hidden characters. When the LogicNets table engine receives this file, the spaces are replaced with an underscore prefix and suffix to the column name, so “col1_name” is created as “_col1_name_” in the data model.