0

I use an R code to download datas from Aspentech IP21 database. Is there a way to know if a tag is in "bad" status or in "good" status. It would be useful, otherwise I get 0 (zeros) when a variable is bad, but I don't know if it really is zero. Thanks.

1 Answers1

0

It depends greatly of what you mean by tag, and where do your data comes from.
For most of the values, quality (good on else) is not defined on tag level, but rather on each value:

  • on record from IP_AnalogDef definition, check for field IP_TREND_QSTATUS, or QSTATUS(IP_TREND_VALUE)
  • on pseudo-table HISTORY and AGGREGATE, it's field STATUS

BUT if your tag comes from a CIMIO for OPC interface, you can query the status of the related Get Transfer record:
select "IO_VALUE_RECORD&&FLD"->NAME tagname, IO_DATA_STATUS, IO_DATA_STATUS_DESC from "TransferDefName" where tagname = 'NameOfYouTag'
Where TransferDefName can be IoGetDef, IoLongTagGetDef, or IoLLTagGetDef
I hope it helps.

Madgui
  • 405
  • 2
  • 10
  • honestley I didn't understand where I should add this part of code. I am connecting from a CIMIO for OPC and I wrote an R code to downaload datas. The core part is the query connection to the server. Where should I add this? thanks. querydb <- paste(start_query,lista_TAG,end_query,sep="") dbconnection <- odbcDriverConnect(paste('DRIVER={AspenTech SQLplus};HOST=',server,sep = "")) # Avvio la connessione a IP21 db_k <- sqlQuery(dbconnection,querydb) odbcClose(dbconnection) – niccolo_guazz Apr 05 '23 at 21:17
  • Reading you code, I think it will be in the end_query part. You should have a WHERE clause. – Madgui Apr 19 '23 at 07:41