This code snippet provides a ZEN page that downloads a stream from its database directly:


/// We assume that you have stored your data within this schema:
/// MyApp.Model.Storage: Filename,FileSize,Content,ContentType
Class zen.downloadStream Extends (%ZEN.Component.page,%CSP.StreamServer)
{
 
    /// Wrapper to get the id of the download, we assume that the id is passed to this zen page
    /// as a URI parameter, i.e.: MyApp.Downloads.cls?OID=1234
    ClassMethod GetId()
    {
        Quit $Get(%request.Data("OID",1))
    }
     
    /// Set the appropriate header for the file.
    ClassMethod OnPreHTTP() As %Boolean
    {
        Set tId = ..GetId()
     
        If ##Class(MyApp.Model.Storage).%ExistsId(tId) {
            Set tStream = ##Class(MyApp.Model.Storage).%OpenId(tId)
            // You could "guess" the content type by its file extension
            // or you can store it (before) in the database separately (like in this example).
            // Set Extension = $Piece(tStream.Filename,".",$Length(tStream.Filename,"."))
            // Set ContentType = ..FileClassify(Extension)
     
            Set %response.ContentType = tStream.ContentType
            Do %response.SetHeader("content-disposition","attachment; filename="_tStream.Filename)
            Do %response.SetHeader("Content-Length",tStream.FileSize)
        }
        Else {
            Set %response.Status="404 File Not Found"
            Quit 0
        }
        Quit $$$OK
    }
     
    ClassMethod OnPage() As %Status
    {
        Set Download = ##Class(MyApp.Model.Storage).%OpenId(..GetId())
        Do Download.Content.OutputToDevice()
        Quit $$$OK
    }
 
}

Link to code on GitHub

2 1
2 569

We need to generate a PDF file from an HL7 message as it passes through an Ensemble production. Looking for examples, tutorials, documentation aligned to our scenario.

We are currently using Ensemble (so can't use InterSystems Reports at the moment). Thinking Zen reports...

We can get from HL7 to XML OK, following Introduction to InterSystems Health Connect - YouTube (see c.1:11:00-1:13:00)

0 1
0 97

Hi,

I want to create a table with a dynamic display of data using the DataGrid.

On the page there dataCombo and the table.

According to the plan, when the user selects an item in dataCombo the table is filled with data. If select another item - data is updated.

But in fact, the data in the table are loaded once when the page is loaded, and when I select value in DataCombo, I receive an error:

0 1
0 401

Hi All,

Actually, I'm developing few restful API's. I want to create a authentication tokens and display it on my login restful API. If I'm using CSP sessionId, how can I validate the session Id's in another or continues restful API's. else, is there any other approach to handle this task.

My Primary goal is, I have to integrate 2 different front end applications. One is Zen framework another one is web pages from Python.

If any lead, it would be appreciated.

Thanks,

Arun Kumar Durairaj.

0 1
0 472
Question
· Jun 24, 2022
RowSpan

What is the correct way to specify rowspan and colspan in a ZEN PDF report using <Item> <Caption>

I am specifying rowspan in the <Caption> tag after the <Item> but it's not working.

0 1
0 247
Question
· Sep 8, 2023
Viewing stored images

Hi Guys,

In my Zen page I've a grid with a list of uploaded images and it's working fine when running from the Server where the application resides where I can just click to an image and my code displays the image in a second screen (MSDS.Image.StreamServer.cls) ,

0 1
1 114
Question
· May 4, 2016
Bootstrap's $navbar

Hi, The ZEN Mojo Widget reference at ../csp/sys/%ZEN.Mojo.WidgetReference.bootstrap33xHomepage.cls is a great reference for viewing the different components available with each helper plugin - and it also supplies snippets of JSON code to use in your layout definitions.

I'm having problems with the Bootstrap $navbar component however. This is layout definition, with a navbar and button contained within the bar.:

0 1
0 329
Question
· Oct 17, 2018
SQLGateWay performance.

I have a ZEN page with nine tablepanes. Each tablepane queries a table in the same SQLServer db. I have a single SQLGateWay(odbc) to this SQLServer db. I need to get better performance when I query all nine table at the same time. Would my performance improve if I had nine SQLGateWays(nine odbc configurations/connections), one for each query? I would appreciate any and all suggestions for getting the very best performance when using SQLGateWays. Thank you.

0 1
0 257

I have a tablePane ZEN Component and I am trying to get a filter running on the Specimen Id / Lab Number. The SQL is fairly complex with 3 UNION ALL statements joining 4 tables and a couple of lookup tables.

How would I get the filter on SpecId to work for my tablePane? It's not automatically applying the filter for me so I think I need code something.

0 1
0 395
Question
· Jun 4, 2018
link component on a ZEN page

When using the link component on a ZEN page the default behavior is for the link to appear to the right of the tablepane row. Has anybody changed this behavior so the link appears to the left of the tablepane row? Thank you in advance for any and all feedback.

0 1
0 214

Creating information dashboards, pivot tables, and widgets is an important step in analysis that provides valuable sources of information for informed decision-making. The IRIS BI platform offers many opportunities to create and customize these elements. In this article, we will take a closer look at the basic techniques for developing them and the importance of using them.

6 1
0 335

Hi all,

I am looking for an implementation idea for displaying a large amount of data received from a webservice. This data are essentialy HL7-Message as a GlobalCharacter Stream and some metadata (status,processed,timecreated etc.).

Since I need sorting functionalities for those metadata a tablepane in a zen page seems to be suitable. i know there are different ways to provide data for the table but in this case it´s complicated to get them data fetched.

Consider the following steps

0 1
0 353

Hi All,

I am providing support to an AP about using document criteria on Multiple Templates (Explicit Dispatch).

I am trying to set the criteria value from:

view.setDocumentKey('initial-search',{patirntId:tPatId});

However it is not possible to get the criteria value on %GetJSONContent through pCriteria parameter object.

How can I do this with Multiple Templates on bootstrap plugin?

Thanks.

0 1
0 300
Question
· Jul 1, 2021
ifexpression syntax

What is the correct syntax when passing values on a zen method after ifexpression?

<pagebreak ifexpression="%report.PageBefore('Graph',1)=1"></pagebreak> ????

.....

0 1
0 170

Hello ,

I want the datagrid to reflect values based on the value i select in the Combobox. How to pass value from the combobox to the

altJSONSQLProvider parameter and reload the datagrid ?

My combobox defines below method on change.

onchange="zenPage.rowSelected(zenThis.getValue());"

<altJSONSQLProvider id="PatchClassJsonId" OnGetSQL="GetSQL" >
<parameter paramName="1" value="C"/>
</altJSONSQLProvider>

<dataGrid

,......

</dataGrid>

0 1
0 199
Question
· Oct 14, 2017
ZenMethod in onunloadHandler

I want to call ZenMethod when page is closing. Is it possible?

I tried

ClientMethod onunloadHandler() [ Language = javascript ]
{
zenPage.SomeZenMethod();
}


Method SomeZenMethod() [ ZenMethod ]
{
// to do some work
}

0 1
0 340
Question
· Sep 18, 2019
Export Report to Excel

Hello, I created a Zen Report and I want to export to Excel. I read I can use $MODE=xlsx but my output in Excel is not correct. All 3 elements are condensed into one cell. Class AETMON.Report Extends %ZEN.Report.reportPage { /// Class name of application this report belongs to. Parameter APPLICATION; /// Specifies the default display mode used for this report if /// the URL parameter, $MODE, is not present.

0 1
0 362