Using CSV File Data in Cimplicity Plant Edition

C

Thread Starter

Chris Ryan

We have an application running that produces a csv file. the data in the file is currently manually entered into a data base. I would like to directly use this csv file data in our cimplicity plant edition project to update point data thereby allowing our SQl database and the reports we generate to automatically supply this data. Any constructive thoughts?

Thanks
CDR
 
S

Steve Bailey

It sounds to me like you need to run a script that opens the .csv file and reads the contents into an array and then writes the array values to Cimplicity points using the 'PointSet' function.
 
Hello Chris,
You can do this indirectly using Cimplicity's Scripting language (BCE).
The command "ReadIni$" reads a string from an ".ini" file.
You can rename your csv file to an ini file. For example, rename "Data.csv" to "Data.ini".
Then run the "ReadIni$". Once you got the text value, convert it to a number. Then use it to set the value of a point using the BCE command, "PointSet".
You can all do these steps in one script.
Please refer to the BCE Help for details on how to use these commands.
I hope this helps you.

Marcel
 
Y

Yosef Feigenbaum

Is there some necessity to read the point data from a CSV file when the actual data is stored in SQL?

I'd recommend reading the data directly from SQL and updating the point data.

In order to do this you have to create an ODBC source to point to the database where your data is stored and use CimBASIC's SQL instructions to read the data into a BCL script. In the script you'd perform the update.

Good Luck,

(8{)} ( .)
[email protected]
 
You can directly take the CSV file into SQL Server using DTS (data transformation services). Then, this information would be available to CIMPLICITY using the BCL SQL* commands. If you want to be able to trend that information, if can either be trended directly from the CSV.
 
W

Walters Curt L Contr AEDC/SVT

Chris,

Write a script using file read the CSV file and set the points with POINTSET
statements like:

Const filename As String = "C:\datafile.csv"
Open filename For Input As #1

Do While Not EOF(1)
Input #1, PointName, PointValue
PointSet PointName, PointValue
Loop
Close

Of course the input statement list would have to match the format of your CSV. The script could be triggered by whatever event is appropriate.

Curt
 
Thanks didn't think about directly using the data into our sql db. i'll give this a try

thanks again
cdryan
 
Top