AnsweredAssumed Answered

UFL reading CSV - skipping missing data

Question asked by ChristophRose on Feb 3, 2020
Latest reply on Feb 5, 2020 by ChristophRose

Hi,

 

I have the following problem and can't seem to find an easy solution.

 

Basically, I have lots of CSV files that are structured exactly like Example 20 in the PI Connector for UFL Samples on Github:

PI-Connector-for-UFL-Samples/Example20_ForEach_Csv.ini 

PI-Connector-for-UFL-Samples/Example20_ForEach_Csv.csv 

However, not all tags always have values for all timestamps. So changing the example, the files would look like this:

TimeStamp,TagCol1,TagCol2,TagCol3,TagCol4
7/12/2017 6:10,1,2,3,4
7/12/2017 6:20,1,,,4
7/12/2017 6:30,,,3,4
7/12/2017 6:40,,,,4

This fails with the message:
Message: [import_exported] Error parse line (2019-11-04 07:21:07.766065,,,28.07152,): [3, [Error] Cannot convert  from String to Number.]

Looking at the value, it is an empty string: ""

 

Various files have varying numbers of tags/columns (between 5 and 500 tags).

I tried using StoreEvent/StoreInPI for each individual tag, reading the tag name from the "TagNames" collection, but I could not find a way to do that. I also tried to find a way to add a NULL value to the "Values" collection, but I also failed with that.

 

I could change the way I create the CSV files (switching to a Timestamp, TagName, Value setup), but that would require setting up different data sources, ini files, etc depending on where the data is coming from, which I would like to avoid if possible.

 

Thanks a lot!

Outcomes