Replacing the SDK in getting AFValue "Run"

I am trying to replace the following SDK call:

PIPoint piPoint = PIPoint.FindPIPoint(piServer, sPITag);
AFTime piTime = new AFTime(dtReadAt);
AFValue CurrentValue = piPoint.RecordedValue(piTime, AFRetrievalMode.Auto);
string status =  CurrentValue.Value.ToString()

Debugger data:
AFValue: Value ="Run" UOM=null Timestamp={6/17/2021 4:12:08 PM} IsGood=true

I've looked at

https://myserver.com/piwebapi/streams/F1RPllGmj5v01Uw3Pk-h_hTekQdQoBQEEDAxNjhcUEFMX8dJTjQeVU6gEC5XSU5ELxhNfw/recorded

which gives me

{
  "Links": {},
  "Items": [
    {
      "Timestamp": "2024-01-24T16:41:24Z",
      "Value": 87.68,
      "UnitsAbbreviation": "",
      "Good": true,
      "Questionable": false,
      "Substituted": false,
      "Annotated": false
    }
  ],
  "UnitsAbbreviation": ""
}

The value returned by the SDK is "Run".

 

-Markus

 

  • Sorry, just posting data retrieved a view days ago. I actually want "now" so I tried:

    https://myserver.com/piwebapi/streams/F1RPLoooooooongWebId/recordedattime?time=*

    result:

    {
      "Timestamp": "2024-01-25T00:21:18Z",
      "Value": 35.36,
      "UnitsAbbreviation": "",
      "Good": true,
      "Questionable": false,
      "Substituted": false,
      "Annotated": false
    }

    Using the SDK "Value" has a value of "Run" but through the API I am getting a decimal.

    PIPoint piPoint = PIPoint.FindPIPoint(piServer, sPITag);
    AFTime piTime = new AFTime(DateTime.Now);
    AFValue CurrentValue = piPoint.RecordedValue(piTime, AFRetrievalMode.Auto);
    
    return CurrentValue.Value.ToString(); //"Run"

     Here is the actual value of CurrentValue from SDK

    {
      "Persist": "134 {<gjuid>} 2\\Good\\6375951234289153298\\\\AFEnumerationValue \\\\PIServers[x0ABC]\\StateSets[VE_OP_STATE]\\Run"
    }

     or debugger

    CurrentValue = AFValue="Run" UOM=null Timestamp={1/6/2023 5:06:39 PM} IsGood=true

     

  • I think I found it. I'll have to see what I was doing wrong:

     

    https://myserver.com/piwebapi/streams/verylongurl/recordedattime?time=*

    {
      "Timestamp": "2023-01-07T01:06:39.3540039Z",
      "Value": {
        "Name": "Run",
        "Value": 3,
        "IsSystem": false
      },
      "UnitsAbbreviation": "",
      "Good": true,
      "Questionable": false,
      "Substituted": false,
      "Annotated": false
    }

     

  • I might have just clicked on a tag that wasn't in the set of tags I was supposed to look at. Thanks for your time, much appreciated.

  • Hi ​ ,

    From the debugger data note, it seems that the value is from the past. Please check what is the value for dtReadAt.

    To get the value from past point in time from piwebapi, please try something similar to below and replace the time with the value of dtReadAt:

    https://myserver.com/piwebapi/streams/F1RPLoooooooongWebId/recordedattime?time=6/17/2021 4:12:08 PM

     

  • ​ ,

    I'm not sure at this point due to lack of information. Please do check if the LongWebID is the one for the tag, sPITag. It would seem that the both calls should return the same information back from DataArchive server.