AnsweredAssumed Answered

PIPutValX (datalink) giving "value written" output but data not showing in PI

Question asked by manishmakwana on Jan 22, 2019
Latest reply on Jan 23, 2019 by tramachandran

Hi folks,



I'm trying to use the datalink PIPutValX function in some VBA code in an excel file to write some historical values to PI. The code runs fine and returns "value written", but the data isn't available when I browse to the PI point in question in SMT.


Here is the code:

Dim TagName As String, TagValue As Range, TagTimeStamp As Date
Dim RootPath As String, TagError As Range
RootPath = ActiveSheet.Cells(2, 7).Value 'test server name
TagName = ActiveSheet.Cells(3, 1).Value 'pi point name
Set TagValue = ActiveSheet.Cells(3, 2) 'pi value to backfill - e.g. 5.84
TagTimeStamp = Format(ActiveSheet.Cells(3, 3).Value, "dd-mmm-yy hh:mm:ss") 'stored as datetime in excel
Set TagError = ActiveSheet.Cells(3, 4) 'output cell for error/result
' validation to skip writing if a cell is empty
If Not (Len(TagName) = 0 Or Len(TagValue) = 0 Or Len(TagTimeStamp) = 0) Then
    macroResult = Application.Run("PIPutValx", TagName, TagValue, TagTimeStamp, RootPath, TagError)


Troubleshooting attempts:

- I've read the discussion here and checked that archives are available for my time range

- I've ensured the timestamp is formatted correctly as discussed here

- I'm using a collective, and have read through this discussion, but I don't care if the data only ends up in the primary


System info:

- PI version: 3.4.400.1162

- System management tools: 2018

- Excel: 2016 32 bit 16.0.11126.20234

- Client system: Windows 10 Pro 10.0.17763


Any suggestions? I don't want to spend too much more time on this - about to switch over to Python and the Web API to get my data in.