Skip to content
  • There are no suggestions because the search field is empty.

How to read data from a text file in the ODBC driver?

Below are step-by-step instructions on reading data from a text file for the ODBC driver (these steps also work for the Advanced Simulator driver):

  1. Open TOP Server
  2. Open your configuration (*.OPF) file
  3. Highlight your channel (Ex. Channel1),  right-click it, and then choose Properties
  4. Go to the Data Source Settings tab and click on the Configure DSN button
  5. The ODBC window (from Windows Control Panel) will open, with the User DSN tab selected - this needs to be changed to the System DSN in order to work with TOP Server running as a Windows service. (A User DSN only works if TOP Server will be run in Interactive Mode).
  6. Click on the Add button
  7. A list of ODBC drivers available on your computer will be displayed.  Scroll down the list and select Microsoft Text Driver (*.txt, *.csv).
  8. Click the Finish button

Now that you have specified the ODBC driver to use, you have to configure it.

  1. Now a window ODBC Text Setup will open, give this driver a name, i.e. "TOPServerTextFile"
  2. Click on the button Options >>
  3. The window will grow in height revealing some hidden options under the screen. Uncheck the checkbox Use Current Directory
  4. Click the Select Directory button, you need to specify the folder where your text file resides. Click the OK button when done.
  5. You return back to the ODBC Text Setup window. Uncheck the checkbox Default (*.*)
  6. Click the button Define Format at the bottom of the screen

Now that You have specified the ODBC driver, you need to configure the structure/format of the Text file.

  1. In the Tables list, pick your filename by simply clicking on it once to highlight it (if you don't see your file in the list, it doesn't exist in the directory you specified in the previous steps).
  2. Check the box Column Name Header
  3. In the format drop-down, pick Fixed Length (if the data in each column is a specific number of characters) or choose one of the delimiter options (if the delimiter between columns in your file isn't listed as an option, you'll choose "Custom Delimited" and specify the correct delimiter character).
  4. Now to define each and every column within your text file... the next block of steps is repetitive
  5. In the Data Type drop-down, pick the data type of the first column
  6. In the Name text field, give the column a name
  7. In the Width text field, specify the width of the column
  8. Click the Add button to add this column to the list Columns
  9. Repeat steps 5 through 8 until all of the columns in your text file are specified
  10. Click OK when done 
  11. You return to the ODBC Text Setup window.  Click the OK button
  12. You return to the ODBC Data Source Administrator window. Click OK
  13. You return back to TOP Server
  14. Be sure to pick the ODBC driver we just created in the Data Source drop-down box. Click the OK button to save this channel data.

 

At this point, you have configured the ODBC data source. Now you need to adjust the configuration settings of your TOP Server device.

  1. Click on the Device Device1 and then right-click on it, choose Properties
  2. The options you specify in here are entirely your choice from this point on.
  3. Once you have clicked the OK button for the Device properties, you should see several Tags appear for that device in the TOP Server's upper-right section of the screen.
  4. You should see tags for each column that you defined within the ODBC Settings, along with some other tags to control the record navigation.