Upon you set this question as "Key Question" bunch of very valuable replies disappeared!
Please, restore everything
- Log in to post comments
Upon you set this question as "Key Question" bunch of very valuable replies disappeared!
Please, restore everything
@Vitaliy Serdtsev Thank you. I still need a bit more clarification.
• In which namespace is ^IRIS.TempRSet located?
• Am I correct in assuming that this mechanism relies on Process Private Globals (similar to Robert’s option)? If not, how can I view the global values in the SMP?
• Does each “rs” value get stored directly in ^IRIS.TempRSet, or does each "rs" data have its own node within ^IRIS.TempRSet? If it saved in separate node, how a name for such a node can be determine?
• Are the stored data/nodes removed automatically, or do they require a manual KILL operation?
@Please clarify the step "d rs.%Save()" above. Where is the data actually stored, and can it be viewed in the Management Portal?
Thank you - everything works
@Robert Cemper While all steps are verified, I am failing to use a variable table name in &SQL(DROP..
Set tStamp = $REPLACE($ZTIME($PIECE($HOROLOG,",",2),1),":","") // in hhmmss format
Set tTable = "%ZZ.resultset"_ tStamp
// Note tTable works for "CREATE GLOBAL TEMPORARY TABLE "_tTable_" as " as well as in SELECT * FROM "_tTable
//Failure
&SQL(DROP TABLE tTable)
Can variable be used in such content? Am I missing something? Thank you
What am I missing? Thank you
=======
{
&SQL(DROP TABLE %ZZ.resultset)
Set sql=2,
sql(1)="CREATE GLOBAL TEMPORARY TABLE %ZZ.resultset as ",
sql(2) ="SELECT * FROM Ens.MessageHeader"
Set statement=##class(%SQL.Statement).%New()
Set result=statement.%ExecDirect(.statement,.sql)
Set a = result.%SQLCODE // a = 0
ZN "HSCUSTOM"
// Attempt to verify via MP>"HSACCESS">SQL:
// SELECT * FROM Ens.MessageHeader > Row count: 8..
// SELECT * FROM %ZZ.resultset > Row count: 0 ...
// Pay attention that there is NO error "Table '%ZZ.RESULTSET' not found"
// Attempt to verify via MP>"HCUSTOM">SQL:
// SELECT * FROM %ZZ.resultset > Row count: 0 ...
// Pay attention that there is NO error "Table '%ZZ.RESULTSET' not found"
}
@Robert Cemper I understand about extended global reference - it is not an issue.
I have issue to execute "..CREATE GLOBAL TEMPORARY TABLE %ZZ.resultset.." related steps from QobjectScript.
Creating a temp (%ZZ..) table, following by it's population and finally dropping it (as you described in your post) must be done programmatically from ObjectScript.
Thank you for guidance.
Thank you—this looks promising. However, when I attempt to reproduce it in Caché ObjectScript, I’m running into syntax errors. Could you please provide a complete ObjectScript example that implements all the steps described above? Thank you.
CREATE GLOBAL TEMPORARY TABLE %ZZ.resultset imply that the table will be accessible from any namespace?Thank you @Evgeny Shvarov. Transferring result from namespace A to namespace B is not a single action to handle. It is an application-wide utility to allow query execution in one namespace and handling a result in another for new and ALREADY exist queries. So, options 2,3,4 above can not be implemented.
But option 1 seems promising if it could be done programmatically. Please, provide code example to TEMPORARILY "map the data for namespace B via global mappings.." and kill such mapping upon getting a result. Thank you.
Per ISC documentation (don't remember correlated section), query ResultSet (%SQL.StatementResult) , executed in one namespace, can not be directly viewed/parsed in a different namespace. Upon ZN to the original namespace, ResultSet is empty.
I am trying to resolve it, by the following steps:
Steps 1 - 5 are done and tested.
I am looking for a code (step 6) to convert JSON to ResultSet.
Did I select a wrong approach?
Thank you
Sorry - I didn't find a code correlated to my question.
I am looking for code EXAMPLE to convert JSON string into ResultSet (%SQL.StatementResult).
Thank you
Thank you. Is there any "similar" utility to convert JSON back into ResultSet?
Thank you. Is there any "similar" utility to convert JSON back into ResultSet?
So far "%SQL.StatementResult" is in use.
Thank you.
I have a ResultSet but I don't know what are column names. How to substitute it's names in the example below?
Please, provide Code example to build a %Library.DynamicObject or a %Library.DynamicArray from Resultset