TN Appsvr116 Reading a CSV file into AppServer UDA's
![]() | ![]() |
How to Read a CSV file into UDA's |
Description
This is a simple scripting example to demonstrate how to read a CSV file into UDA arrays. The scripting uses QuickScript .NET functions and is intended for Application Server.
Author | Rich Brooks |
Publish Date | 7/9/2014 |
Applies to Software | Application Server |
Applies to Version | 3.1 SP3 Patch1 and greater |
Applies to System/Module | Scripting |
Article Version | 01.00.00 |
************************************************************************************************************************************************************
Detailed Steps
There are many options in .NET for reading CSV files. The scripting example given here uses
the System.IO.StreamReader class. It is built for a three column CSV file as shown below.
Each line of the CSV file is read in using the ReadLine method. The columns are parsed out
using the various String methods. A while loop looks for the end of the file using the Peek
method. Below is a screen capture from the IDE.
The following is the example scripting used.
The object hosting the script was deployed from the IDE and tested out from the Object Viewer.
Each column has been parsed out to their respective UDA.