Question Jorge de la Garza · Jan 9, 2020

I have an array of table names that I want to iterate over and for each table, get the number of rows.  I was hoping I could do something like:

set tStatement = ##class(%SQL.Statement).%New()set tSC = tStatement.%Prepare("SELECT COUNT(*) AS ObservedRowCount FROM ?")$$$ThrowOnError(tSC)set tTableName = ""for{  set tTableName = $O(tCounterAry(tTableName))  quit:tTableName=""set tResult = tStatement.%Execute(tTableName)
  // ...
}

But that doesn't work:

ERROR #5540: SQLCODE: -1 Message:  IDENTIFIER expected, ? found^ SELECT COUNT ( * ) AS ObservedRowCount FROM ?
2
0 649
Question Jorge de la Garza · Mar 10, 2017

What are the differences between a process private global and a percent variable?  Basically I have some code running in an Ensemble operation that processes requests, and it needs access to pieces of data that are scattered throughout XData blocks in various classes.  Rather than opening the XData object and deserializing the XML on each request, I opted to cache this data in a percent variable, something like:

set %MyVar(sub1,sub2) = myValue

10
0 1958