alex.huang

PI UFL Help with csv data format

Discussion created by alex.huang on Sep 3, 2020
Latest reply on Sep 30, 2020 by mhruzik

Hello all,

 

I'm having a bit of trouble writing the INI file for UFL to parse a csv report. The csv file looks like the following:

Point System Name:Temp_Tag_1  
Trend Every:15 minutes  
Date Range:9/1/2020 00:00:00 - 9/1/2020 23:59:59  
Report Timings:All Hours  
9/1/20200:00:0068.03 -N-       NONE
9/1/20200:15:0068.01 -N-       NONE
9/1/20200:30:0068 -N-       NONE
9/1/20200:45:0067.98 -N-       NONE
9/1/20201:00:0067.98 -N-       NONE
9/1/20201:15:0067.97 -N-       NONE
9/1/20201:30:0067.99 -N-       NONE
9/1/20201:45:0068.01 -N-       NONE
9/1/20202:00:0068.03 -N-       NONE
9/1/20202:15:0068.03 -N-       NONE
9/1/20202:30:0067.99 -N-       NONE
9/1/20202:45:0067.99 -N-       NONE
9/1/20203:00:0067.97 -N-       NONE
9/1/20203:15:0067.99 -N-       NONE
9/1/20203:30:0067.99 -N-       NONE
9/1/20203:45:0067.99 -N-       NONE
9/1/20204:00:0067.99 -N-       NONE
Point System Name:Temp_Tag_2
Trend Every:15 minutes
Date Range:9/1/2020 00:00:00 - 9/1/2020 23:59:59
Report Timings:All Hours
9/1/20200:00:0066.06 -N-       NONE
9/1/20200:15:0065.98 -N-       NONE
9/1/20200:30:0065.96 -N-       NONE
9/1/20200:45:0065.95 -N-       NONE
9/1/20201:00:0065.95 -N-       NONE
9/1/20201:15:0065.95 -N-       NONE
9/1/20201:30:0066 -N-       NONE
9/1/20201:45:0066.04 -N-       NONE
9/1/20202:00:0066.06 -N-       NONE
9/1/20202:15:0066.06 -N-       NONE
Point System Name:Temp_Tag_3
Trend Every:COV
Date Range:9/1/2020 00:00:00 - 9/1/2020 23:59:59
Report Timings:All Hours
No data in range specified.

 

My current code is:

 

Code

[FIELD]
FIELD(1).NAME="Date_String"
FIELD(1).TYPE="String"
FIELD(2).NAME="Time_String"
FIELD(2).TYPE="String"
FIELD(3).NAME="Timestamp"
FIELD(3).TYPE="DateTime"
FIELD(3).FORMAT="M/d/yyyy h:m:s"
FIELD(4).NAME="Point_Alias"
FIELD(4).TYPE="String"
FIELD(5).NAME="Value"
FIELD(5).TYPE="Number"


[MSG]
MSG(1).NAME="Points"

 

[Points]
Points.FILTER=C2=="Temp_Tag*"

 

'Set Point Alias for now
Point_Alias = ["*,(*),*,*]

 

'Skip to Data
Skiplines(3)

 

'Defining Strings and Timestamp
Date_String = ["(*),*,*,*]
Time_String = ["*,(*),*,*]
Value = ["*,*,(*),*]
Timestamp = Concat(Date_String," ",Time_String)

 

If (Value IS NULL) Then

 

   SkipLines(2)
   If Time_String IS NOT NULL Then
      SetNextMsg("Points",)
   Else
   ENDIF

 

Else

 

   StoreInPI(,Point_Alias,Timestamp,Value,,)

 

ENDIF

 

The code is able to read all the data but only stores it into the first variable it finds. Also I'm trying to figure out an iterative way of doing this as I don't want to have to hard code in 100+ points.

Outcomes