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

 

Parents
  • 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

     

Reply
  • 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

     

Children