InterSystems Developer Community is a community of 18,110 amazing developers
We're a place where InterSystems IRIS programmers learn and share, stay up-to-date, grow together and have fun!

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 574

The following post outlines a more flexible architectural design for DeepSee. As in the previous example, this implementation includes separate databases for storing the DeepSee cache, DeepSee implementation and settings, and synchronization globals. This example introduces one new databases to store the DeepSee indices. We will redefine the global mappings so that the DeepSee indices are not mapped together with the fact and dimension tables.

2 1
0 549
Question
· Jun 18, 2018
CSP Error Log

I thought I should be able to go to the application error log or look at d ^%ER when I get the following error in the browser when troubleshooting a CSP page:

An error occurred with the CSP application and has been logged to system error log (^ERRORS)

However nothing is being generated in these logs. Where are these logs being made?

Thank you

2 9
1 2.2K

Hi, Community!

Please find a new session recording from Global Summit 2017:

Optimizing SQL Queries

https://www.youtube.com/embed/nEKYDd2meDM
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

2 0
0 398

Hi Everyone!

New session recording from Global Summit 2017 is already on InterSystems Developers YouTube:

Secure File Communication

https://www.youtube.com/embed/Oe-qPhAvHj4
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

1 0
0 260

Hi, Community!

This is a digest of the Developer Community postings in September 2018.

 

Most viewed

Atelier 1.3 Stable Release  324

Intersystems IRIS and the next applications generation  149

How the Intersystems IRIS ended to anemic databases era  141

Dynamic objects and JSON support in InterSystems products  141

UDL support  127

Global Summit 2018: Unconference topics to discuss  118

How I implemented GraphQL for InterSystems platforms  116

Is there a function similar to Oracle's CDC in the cache database?  116

Find a table given its name  113

parsing xml response  105

 

Most voted

Atelier 1.3 Stable Release  10

George James Software lunchtime meeting at Global Summit 2018  10

Save the date - DACH Symposium 2018  9

Sharding evaluation #1  8

Sharding evaluation #2  7

Atelier Source code versioning  5

Intersystems IRIS and the next applications generation  4

Global Summit 2018 - Make sure you hang out till Wednesday!  4

Developer Community September 2018 Release  4

New Video: Atelier – Debugging a Class  4

 

Most commented

How can I create properties (DocDB, Python)?  15

Is there a function similar to Oracle's CDC in the cache database?  15

parsing xml response  13

How to open Cache studio on Mac OS   11

Change time in message browser etc from UTC to local time  10

LDAP Connection/Configuration  9

class Ens.Queue visible to ODBC?  9

How to Open Terminal In Caché Mac OS  9

Impact of OREF support  9

Visual Report alternatives  8

 

Top 10 Authors to Follow by Views

Gevorg Arutunyan, Posts,  379

Yuri Gomes, Posts,  290

Robert Cemper, Posts,  190

Eduard Lebedyuk, Posts,  187

Dmitry Maslennikov, Posts,  185

Rustam Ibragimov, Posts,  127

Alexander Tsvetkov, Posts,  78

Mark Bolinsky, Posts,  60

Raymond Lawrence, Posts,  43

Irene Mikhaylova, Posts,  38

 

Top 10 Experts to Follow

Fred Gustafsson, Answers,  +5

Robert Cemper, Answers,  +4

Jolyon Smith, Answers,  +3

Nicole Aaron, Answers,  +3

Alexander Koblov, Answers,  +2

Tomas Vaverka, Answers,  +2

Len Goodkin, Answers,  +2

Herman Slagman, Answers,  +2

Evgeny Shvarov, Answers,  +1

Eduard Lebedyuk, Answers,  +1

 

1 0
0 208

Users of analytical applications often need to generate and send out PDF reports comprised of elements of the analytical panel. In the InterSystems stack, this task is solved using the DSW Reports project that is an extension of DeepSeeWeb. In this article, we will explain how to use DSW Reports for generating PDF reports and emailing them.

1 0
1 516

Hi Developers!

New video from Global Summit 2018 is available now on InterSystems Developers YouTube:

Modernize Traditional Applications

https://www.youtube.com/embed/pQAxZ1cwB4U
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

1 0
0 238

I have a dataListBox in ZEN which has an OnDrawItem method associated with it. The DrawItem method never seems to be called and I cannot see why. I am using IE11. Can anyone suggest a reason? The attached code runs in a namespace called CODE and can be run using view webpage on the TheLabsApp.BioAnal class. Please note that the data is in a global called ^%ANAL that resides in %SYS.

1 3
0 244
Question
· Feb 20, 2018
REST Data Limit

I'm experimenting with sending large amounts of data in a POST payload to be stored as a stream. However I've noticed that no matter how many characters are in the message, Cache only gets about 32k of them, cutting off the rest. Conversely as expected it can only send about 32k worth of characters in a payload.

Before I get creative, is there a REST message size limit that can be changed? Or is there something else going on here?

Thank you!

1 9
0 1.1K

Hi, Community!

Check a new session recording from Global Summit 2017:

Pros and Cons of Virtual Environments

https://www.youtube.com/embed/87eG_zAbb9Y
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

1 0
0 339