go to post Thembelani Mlalazi · Sep 27, 2019 @Suman Samanta Please have a look at this question I posted earlier if you still need more code let me know here
go to post Thembelani Mlalazi · Sep 27, 2019 @Tomas Vaverka Yes that right but I know that the question may be was not clear I have an object class which has two properties one a string and a stream and was trying to pass that object ,all I could do was pass a string and an empty stream but I have read around the stream and found out that I can pass a stream as a stream but not inside an object thanks again
go to post Thembelani Mlalazi · Sep 25, 2019 @Hansel Rudy Stange Gaete I am trying to send a pdf document encoded to base64 which means the size could vary depending on the document
go to post Thembelani Mlalazi · Sep 25, 2019 @Hansel Rudy Stange Gaete Was wondering did you get this problem solved I also have an object with a stream property that I am trying to return in a soap response and is blank but in the trace on the production is populated any help appreciated
go to post Thembelani Mlalazi · Sep 23, 2019 @RobertC.Cemper.C.Cemper I am using 2014.1 version of Ensemble
go to post Thembelani Mlalazi · Aug 15, 2019 @Warlin Garcia Thank you just what I needed $LISTGET(CList,i)
go to post Thembelani Mlalazi · Jun 17, 2019 Using the XLFOWrapper by @Attila Toth managed to twick it around to produce pdfs from stream for future reference you can visit his GitHub page or a fork repository by Tim to see the version that worked for my use case
go to post Thembelani Mlalazi · Jun 14, 2019 @Attila Toth thank you but I managed to crack it and I have sent you the code to update if you like
go to post Thembelani Mlalazi · Jun 13, 2019 I am using the supplied FakeXML as below ClassMethod FakeXML() [ Internal ]{ Write "<fofile" _ $Case(%report.FOFilename, "": "", : " name=""" _ ##class(%File).NormalizeFilename(%report.FOFilename) _ """") _ $Case(%report.FOStreamString, "": "", : " FOStreamString=""" _ %report.FOStreamString _ """") _ $Case(%report.CallbackClass, "": "", : " callbackClass=""" _ %report.CallbackClass _ """") _ $Case(%report.CallbackMethod, "": "", : " callbackMethod=""" _ %report.CallbackMethod _ """") _ "></fofile>"}
go to post Thembelani Mlalazi · Jun 13, 2019 @Attila Toth thanks for getting back at me I have tried with log errors and I get a pdf generated which I can not open as if I have a loop running or the file being corrupt your solution works fine with the reading of files and using the call back method with embedded XLFO is it possible to supply the call back method with the XLFO stream and use that instead and if possible please could you give us an example if you have one thanks
go to post Thembelani Mlalazi · Jun 13, 2019 @Attila Toth I am using your FOWrapper to pass a stream of XLFO data in my production to generate a pdf and nothing is happening I am not getting any errors or anything would you please advice on where I am going wrong I have altered it a bit to use what I need please advice here is my code thanks in advance Include Ensemble IncludeGenerator (%occInclude, EnsUtil) Class ZEN.Report.XLFOToPDFWrapper Extends %ZEN.Report.reportPage { Parameter DEFAULTMODE As STRING = "xml"; /// Default value for the CallbackClass property. This can be set in subclasses! Parameter DEFAULTCALLBACKCLASS; /// Default value for the CallbackMethod property. This can be set in subclasses! Parameter DEFAULTCALLBACKMETHOD; Parameter ENCODING = "Windows-1252"; Property FOStreamString As %Stream.FileCharacter(ZENURL = "FOSTREAMSTRING"); /// If this and the CallbackMethod are not empty and referring a valid class and method name, /// then the return value of the corresponding classmethod (which should be a character stream) is used as the XSL-FO file. Property CallbackClass As %String(ZENURL = "CLASS") [ InitialExpression = {..#DEFAULTCALLBACKCLASS} ]; /// If this and the CallbackClass are not empty and referring a valid class and method name, /// then the return value of the corresponding classmethod (which should be a character stream) is used as the XSL-FO file. Property CallbackMethod As %String(ZENURL = "METHOD") [ InitialExpression = {..#DEFAULTCALLBACKMETHOD} ]; /// This callback is invoked after this report is instantiated /// and before it is run. Method %OnBeforeReport() As %Status [ Internal ] { Set tSC = $$$OK If (..CallbackClass '= "") && (..CallbackMethod '= "") { TRY { Set tSC = $CLASSMETHOD(..CallbackClass, ..CallbackMethod, .fostream) } CATCH ex { Set tSC = ex.AsStatus() } } Else { Set fostream = ##class(%Stream.FileCharacter).%New() While '..FOStreamString.AtEnd { Set tSC = fostream.Write(..FOStreamString.Read(32000)) } $$$TRACE(fostream) $$$LOGWARNING(fostream) } If $$$ISOK(tSC) { // TODO: automatically append XSLT frame around the XSL-FO file. Set ..toxslfostream = ..TransformFO2XSL(.fostream) Do ..toxslfostream.Rewind() } Quit tSC } /// This report has a "fake" XML definition. Basically any XML would do, because the XSL-FO file is created outside of the ZEN Report class. XData ReportDefinition [ XMLNamespace = "http://www.intersystems.com/zen/report/definition" ] { } /// Method, which generates the "fake" XML content of the report. /// At the moment this contains a single element (), which reflects the parameters of the report.' ClassMethod FakeXML() [ Internal ] { Write "" } ClassMethod ProducePDFFile(pOutputFile As %String, pXLFOStream As %String, pDisplayLog As %Boolean = 0, pRenderServer As %String = "") As %Status { Set tSC = $$$OK Set report = ..%New() Set report.FOStreamString = pXLFOStream Set tSC = report.GenerateReport(pOutputFile, 2, pDisplayLog, pRenderServer) Quit tSC } /// Appends the XSLT frame around the original XSL-FO stream, to make it usable with this report class. ClassMethod TransformFO2XSL(ByRef pFOStream As %Stream.Object) As %Stream.Object [ Internal ] { Set tSC = $$$OK Set xslStream = ##class(%Stream.TmpCharacter).%New() Do pFOStream.Rewind() Set first100 = pFOStream.Read(100) If $Extract(first100, 1, 2) = "", 1) _ ">" Set first100 = $Piece(first100, ">", 2, *) } Else { Set xmlHeader = "" } Do xslStream.WriteLine($Select( xmlHeader '= "": xmlHeader, 1: "")) Do xslStream.WriteLine("") Do xslStream.WriteLine("") Do xslStream.Write(first100) While 'pFOStream.AtEnd { Do xslStream.Write(pFOStream.Read(32000)) } Do xslStream.WriteLine("") Do xslStream.WriteLine("") Quit xslStream } } and on my operation I call it like so Class FopPDFRenderingEngineOPRN Extends Ens.BusinessOperation { Parameter ADAPTER = "EnsLib.File.OutboundAdapter"; Property Adapter As EnsLib.File.OutboundAdapter; Parameter INVOCATION = "Queue"; Method Render(pRequest As RenderRequestMREQ, Output pResponse As RenderRequestMRES) As %Status { set tSC = $$$OK set pResponse = ##class(Ecrion.PublishingEngine.RenderRequestMRES).%New() set pResponse.FileName = pRequest.FileName set pResponse.Status = 0 #Dim oHttpReq3 AS ZEN.Report.XLFOToPDFWrapper= ##class(ZEN.Report.XLFOToPDFWrapper).%New() // if the input format is xslfo Base64Encode the stream if (pRequest.InputFormat = "xslfo") { // write the request object set pResponse.Document = ..getStreamData(pRequest.Source) set p=oHttpReq3.ProducePDFFile(..Adapter.FilePath_pRequest.FileName,..getStreamData(pRequest.Source)) If ($$$ISOK(p)) { set pResponse.Message="all good" }else { set pResponse.Message=$$$ISERR(tSC) } kill oStream } kill oStream quit tSC } Method getStreamData(foo As %Stream.TmpCharacter) As %Stream.TmpCharacter { set oStream = ##class(%Stream.TmpCharacter).%New() while ('foo.AtEnd) { do oStream.Write(foo.Read(1200)) } do oStream.Rewind() quit oStream } XData MessageMap { Render } }
go to post Thembelani Mlalazi · Apr 18, 2019 After some investigation on the above problem I realised that when purging record map data the data integrity check is the problem as I am using Ensemble 2014.1 the relationships on those is a one to many so when deleting these objects there is an %ondelete method which invokes a delete record method which tries to delete a record and then delete the batch but it does not check if that batch still have records associated with it. Now a new problem arises where I have tried to delete individuals records in a batch successfully but when trying to delete the batch its self it errors with a 5002 ROLLback error now the question is how to get around this problem
go to post Thembelani Mlalazi · Apr 12, 2019 @Eduard Lebedyuk all ready tried that but it refreshes the whole page
go to post Thembelani Mlalazi · Apr 10, 2019 @Eduard Lebedyuk No it is not a known node what I am trying to do is pull those characters and pass them to $TRANSLATE($SYSTEM.Encryption.Base64Encode(streamString),$C(10,13))' as part of a document I need to convert to a pdf but have tried all the encodings I could use from utf -8 to the windows 1252 and I get an error like so ERROR <Ens>ErrException: <ILLEGAL VALUE>zEncodeStream+18 @' set encString = $TRANSLATE($SYSTEM.Encryption.Base64Encode(streamString),$C(10,13))' any ways to get around the base 64 encoding
go to post Thembelani Mlalazi · Apr 9, 2019 @Jon Willeke I mean the above characters I would like to have them on an xml in their ASCII format(HTML Format)eg bullet point in •
go to post Thembelani Mlalazi · Apr 5, 2019 @sjbttt sjbttt did you final get the solution to this if you did would you kindly share the solution please
go to post Thembelani Mlalazi · Mar 12, 2019 Thanks this is what I am trying to do Method StringToDate(pd As %String) As %Date { #dim theDate as %Date SET theDate =$zdateh(pd,4) w $ZDate(theDate,3) QUIT }
go to post Thembelani Mlalazi · Feb 18, 2019 @Anastasia Dyubaylo why are you editing all my questions
go to post Thembelani Mlalazi · Feb 8, 2019 $LENGTH(pRequest.GetValueAt("PID:3") please note this does not give me list length rather it take the PID as a string and give me the length of the string I need to able to extract the individual values in the segment that's the length I need