@Evgeny Shvarov and @Alex Woodhead 

Lots of good progress here, but still a few issues:

- Thanks to @Dmitry Maslennikov and his help, I am using a Dockerfile and compose to do the build, so everything is a little more contained and standard (I used that coffee store template as a starting place)

- After running App.Installer.setup() via the Dockerfile commands, I run do ##class(%EnsembleMgr).EnableNamespace("$NAMESPACE").  After that I do some application setup logic including a recompile of those classes that depend on those Ensemble classes and I finally get that clean compile of those classes and no error messages saying HL7.Class does not exist.  

- As I mentioned before, the namespace element in the Installer.cls manifest has interoperability turned on <Namespace Name="${NAMESPACE}" Code="${NAMESPACE}-CODE" Data="${NAMESPACE}-DATA" Create="yes" Ensemble="1">

- How can I run the command do ##class(%EnsembleMgr).EnableNamespace("$NAMESPACE") after the creation of the application's namespace but BEFORE loading and compiling the source code? My only workaround is to recompile after running App.Installer.setup()  and do ##class(%EnsembleMgr).EnableNamespace("$NAMESPACE").  I'm not sure how and where the manifest for the application in App.Installer is used and where I can insert this enable method.  That said, I feel like that <Namespace> tag should be turning it on.  I can't find a reference in the documentation for this manifest.

- Another question/issue is CSP pages.  Following the template, in the docker file I 'COPY csp csp`.  In the installer I mapp the source director to all the code I put in the src folder (classes and mac files).  Should I copy my CSP file here as well so they compile?  My workaround is similar to above, I use a utility to compile the CSP pages in the csp director since the installer doesn't pick them up since they aren't in the source dir.

@Dmitry Maslennikov 

It's a bit much and there's probably a better way, but the long story short is that many of our static files are in a folder in the root, so I have to build the container, run a 'docker exec' command as root to copy my file to the root, exit out of that, then log in again as a the regular user to start the iris session and run the build script.  

The script uses the sleep command to wait (now at 70 seconds and working fine) for iris to finish starting so I can start the session and run the script.  Otherwise I get the startup error.  

@Julie Bolinsky and @Stephen Canzano 
 

Thanks for your replies!

To back up and offer more clarity: the issue was that the WHERE clause of our query used a stored procedure to calculate a data element. This was causing the query to churn and for the Zen reports to timeout.  We wanted to break the query apart so that it could select a subset of the data by date range first and then loop through that data and run the store proc only that data to filter it further.   A subquery didn't end up being any more efficient here.  Views and CREATE TABLE ... AS wouldn't work at scale.  Since Zen wants a %Library.ResultSet object, I researched fetching each record and deleting data as needed OR creating a new %Library.ResultSet object and adding data to that, but there are no methods to support that.

The question was: can you give a Zen report a dynamic object as a data source?

Sounds like the answer is only %Library.ResultSet or XML file (or stream).  The stream idea is ok, but it's a big report and it would have been a big lift to transform the %Library.ResultSet into XML.

The solution was 1) move the stored proc out of the WHERE clause and into the SELECT and 2) use the filter='%val(""DataElement"")=VALUE' in the report tag to evaluate the table alias created by the stored proc in the select to skip the rows we didn't want to generate PDFs for.

Happy to talk more about this as I'm sure I'll be touching some Zen stuff again.

@Benjamin De Boe 
 

I went nuts today working with some of this stuff.  Can I confirm a few points:

- $SYSTEM.SQL.Schema.QueryToTable() does not exist in my IRIS version however $SYSTEM.SQL.QueryToTable() does.  I have IRIS 2021. Are these different things?

- I ended up using a CREATE OR REPLACE VIEW because doing a CREATE TABLE ... AS SELECT would create a table but return no data (I would even do a DROP TABLE operation first to make sure all was clear.  Am I correct in saying that a create table as select is strictly as COPY operation of an existing table.  Since I was effectively creating a new table with new headers, the view worked better here.  Is that the difference?

- To clarify, I used the $SYSTEM command to create table from query, because I kept getting errors with create table as select (didn't like my AS statement).  What could have gone wrong there?

@Timothy Leavitt 

Another question popping up.  How do I access the test result on the command line to see if it failed?  When I run DebugRunTestCase, the the URL spits out with the result index in it.  I created an instance of Manager and then ran the method but I don't seem to get any properties or output that say "this failed."

Thoughts here?

@David Hockenbroch 

Thanks!

I think the major assumption I forgot to mentioned was that this is an existing web app built on CSP that we would like to modernized with REST APIs.  

So to begin with the methods are defined in the CSP file and now we want to port them over to a REST API.  Since it's a generated class I get nervous calling it like I am but I don't see another way.

@Eduard Lebedyuk 

Thanks for this article.  I have followed this along with the online documentation and I am having an issue that maybe you can offer guidance on?

I have my web app setup, enabled, set to no authentication (just testing and learning right now so trying to make it as simple as possible), and my generated "Package.disp" class in the dispatch parameter.  

It WAS working.  Then I tried to call it from a React app using Axio to make the call and there were some CORS issues.  So I started playing with those settings 1) added "Access-Control-Allow-Origin=*" to the header of the request 2) added "Parameter HandleCorsRequest = 1;" to the Package.spec and 3) now that I've seen it in your article, added "x-ISC_CORS": true, to the path setting in the spec.

401 error every time. 

I even changed the auth in Postman from no auth to basic auth and put in my localhost creds.  401.  I've looked at the Auit Log and I see some activity every time I make the call but I'm not sure how to interpret. Even when I try to revert to my setup pre-playing-around-with-CORS, I get the 401 again.

What could be causing a 401 when everything is setup to be so relaxed?

@Brett Saviano 

Sorry, back again. Feeling like a dunce here . . . I updated my API using my OpenApi 2.0 JSON spec and the /api/mgmt POST call and looking in Studio, I can see my spec.cls is showing v 1.5 as I expect. When I refresh the explorer view (which is the live server, yes?) I'm still on v 1.4 which is my old spec.

Is there some other setting that might be preventing this refresh?

I looked here: Settings Reference - InterSystems ObjectScript for VS Code (intersystems-community.github.io), but I didn't find anything that stood out as a setting that would stop a refresh of the explorer view from showing updated classes on the server.