Converting a list of non persistent objects into a ResultSet
Hello,
I'm using ZEN report to generate a PDF file out a table.
Although, I need to display data from two tables splitted into two different namespaces.
So, I created a process that fetches all the data I need and then calls the PDF class and generates the stream out of it.
My question is, once I've got my list of objects. How can I transform it into a ResultSet, in order to display in the report ?
Thanks for your answer.
I think the easier solution would be to map classes and data to a target namespace and just execute the query in the same namespace. Documentation.
Actually, I tried that.
But since, the two packages have the same name. Once I map namespace A to namespace B, I can't access the package in namespace B
Okay, even if the classes/globals are the same there's a solution. Let's say you have Sample.Person class in namespaces SAMPLES and USER, each with their own data:
And you want to query both from the USER namespace. In that case create a new class extending Sample.Person in the USER namespace and modify storage like this:
Note that DataLocation, IndexLocation, IdLocation and StreamLocation point to the SAMPLES namespace.
Now query:
Would fetch data from SAMPLES namespace.
Yes, it works.
Thank you
In the past when I've had to do something like this I've leveraged https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls.... In the custom Execute method I would accumulate all of the data and place in a process private global. In the Fetch method, I get one row out of the process private global at a time.
The easiest solution here is to link the table from another namespace. Only takes a second and you don't need to screw around getting the storage right (note: do NOT start editing storage defs if you can avoid it - that is not an easily maintained solution). This solution does not work if you have to JOIN the two tables together (we call this a heterogeneous JOIN), however. The next best solution is to write your own class query as @Stephen Canzano & @Michael Smart have recommended. It's a little work up front but you can make some easy changes, such as creating a temp table and populating it with data from the other namespace or using a process private global.
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue