AnsweredAssumed Answered

How to add a number of days to a date with UFL interface

Question asked by alouette_pelr on Jul 15, 2019

A weather station generate a file with a timestamp in the format Year,JulianDay, hour_minute. Ex: 2019,194,1400 for july 13, 2019 14:00. I want to generate a PI Timestamp from those fields.

 

My approach was to generate a datetime field corresponding to january 1st of the year received and add a number of days to this field. 

But when i try to add a number of days from a Int32 field, i get and error.  I can add a time field to a datetime field but not an integer number of days.

 

FIELD(2).TYPE="TimeRecv"
FIELD(2).FORMAT="hhmm"

FIELD(8).NAME="YearRecv"
FIELD(8).TYPE="Number"

FIELD(9).NAME="JulianDay"
FIELD(9).TYPE="Int32"
FIELD(10).NAME="MyPITimestamp"
FIELD(10).TYPE="DateTime"
FIELD(10).FORMAT="dd-MM-yyyy hh:mm:ss"
FIELD(11).NAME="January1"
FIELD(11).TYPE="DateTime"
FIELD(11).FORMAT="dd-MM-yyyy"

 

January1 = Concat("01-01-",YearRcev)

Print(January1)    ---> 01-Jan-2019 00:00:00.0000  it Works!

 

MyPITimestamp = January1 + JulianDay   

 

---> Error at interface startup " [PI_UFL] [Line 83] [+] [Error] Overload resolution failed for + argument

 

But this line work :

MyPITimestamp = January1 + TimeRecv   

 

May be it would be nice to have Osi add a Julian Date Format in UFL interface.

Outcomes