go to post Ashok Kumar T · Aug 21 Instead of using obj.%Get("property"), you can use %IsDefined("key"), which returns 1 if the key exists. You can also use %Get("key",, "type"), where the optional type parameter specifies the expected return type. This helps prevent <MAXSTRING> errors when handling values near IRIS's maximum string length. To enable native JSON support in a persistent class, extend %JSON.Adaptor. This provides built-in methods such as: %JSONImport() — Imports a JSON or DAO directly into the object. %JSONExport()— Export and display the value in the device %JSONExportToString()— Export the value as a string. %JSONExportToStream() — Export the value as a stream Class Company.Employee Extends (%Persistent,%JSON.Adaptor) { Property Name As %String(MAXLEN=50); Property Age As %Integer; Property Department As %String(MAXLEN=50); ClassMethod LoadData() As %Staus { Set json = {"Name":"Test", "Age": 20, "Department": "IT"} Set obj = ..%New() Set sc = obj.%JSONImport(json) Set sc = obj.%Save() Return sc } ClassMethod ExportDataAsJSONString(Id) As %String { Set obj = ..%OpenId(Id) Do obj.%JSONExportToString(.string) Return string } ClassMethod ExportDataAsJSONStream(Id) As %Steam.Object { Set obj = ..%OpenId(Id) Do obj.%JSONExportToStream(.stream) Return stream } } If you're working with classes, it's recommended to use object-based or SQL-based data manipulation rather than directly using globals.
go to post Ashok Kumar T · Aug 21 Hi @Rutvik ISM The FHIR binary resource data is exceeding the maximum length allowed by InterSystems IRIS. To store documents such as PDFs and other large data, you should use streams. Use %Stream.GlobalBinary or %Stream.GlobalCharacter to store the data within the database. Use %Stream.FileBinary or %Stream.FileCharacter to store the files on the file system.
go to post Ashok Kumar T · Aug 21 `Hi Rutvik You can handle this error with below code. Some sample code swt datatype "stream" While iter.%GetNext(.key, .value, .datatype) { } If you want to get the values as a stream from DynamicObject Use %Get(key,,"stream") set stream = dao.%Get(key,,"stream") This 3rd parameter support in %GetNext() and %Get() from 2022 version There is a specific reason for using this custom code instead of relying on the built-in %FromJSON() method. The third argument is currently not implemented in the following ##class(HS.FHIR.DTL.vR4.Model.Resource.Binary).%FromJSON(fhirresourceStream) ClassMethod SetBinaryR4(json As %DynamicObject) { Set obj = ##class(HS.FHIR.DTL.vR4.Model.Resource.Binary).%New() Set obj.contentType = json.contentType // Convert large data field to stream Set dataAsStrm = json.%Get("data",,"stream") Set obj.data = dataAsStrm Set obj.id = json.id } Thank you!
go to post Ashok Kumar T · Aug 21 Kudos to You! 🎉 Your efforts have made a real difference. The passion and commitment you bring have not only contributed greatly but also sparked meaningful change. Thank you
go to post Ashok Kumar T · Aug 8 Hi @Olga Zavrazhnova Are badges currently still being distributed for user contributions?
go to post Ashok Kumar T · Aug 7 Hi @HARIHARAN ARIVANANDHAM Can you share more information about the xml parse error.
go to post Ashok Kumar T · Aug 5 The %BuildIndices class method is used to rebuild all indices on the class. To run it asynchronously, use the following: Do ##class(Ens.Util.Log).%BuildIndices() Do ##class(Ens.Util.Log).%BuildIndicesAsync() To rebuild a specific index, pass the index name as a list value: Do ##class(Ens.Util.Log).%BuildIndices($LB("TimeLogged")) You can also rebuild indices using SQL from 2021 version Rebuild all indices BUILD INDEX FOR TABLE Ens_Util.Log Rebuild a specific index BUILD INDEX FOR TABLE Ens_Util.Log INDEX TimeLogged
go to post Ashok Kumar T · Aug 5 Hi @shima Avakh Ens.Queue class provides various methods for working with queues. Queue-related information is stored in the global ^Ens.Queue. To abort messages from a specific queue, you can use the following class method Do ##class(Ens.Queue).AbortQueue(pQueueName) Replace pQueueName with the name of the queue you want to abort. This method allows you to target and abort messages in a specific queue.
go to post Ashok Kumar T · Jul 24 You can use :py alias to connect the python shell in IRIS terminal as well.
go to post Ashok Kumar T · Jul 23 Thank you for the explantaion @Steven Hobbs .In the subroutine ETNMINIM, the date is retrieved solely from $H (S h=$H). Given that, why are the errors recorded under the date 01/06/1841 ($ZDH=6) in ^ERRORS instead of the actual date on which the error occurred?
go to post Ashok Kumar T · Jul 21 Grateful for the recognition. Kudos to all winners and participants👏!
go to post Ashok Kumar T · Jul 21 You can use the Log() method or do LOG^%ETN(ErrorMessage) inside the Try{} Catch ex{} block and routine to capture the error on Application Errors.
go to post Ashok Kumar T · Jul 17 Hello @PhoebeK If emailAttachmentList is a DynamicArray, then the following property declaration is correct: Attempt 2 // Property emailAttachmentList As List of Request.EmailAttachment(%JSONFIELDNAME = "emailAttachmentList"); It looks like you're trying to set the value directly like: callrequest.emailAttachmentList.attachmentClass = "application/xml" However, since emailAttachmentList is a list, you need to either:- Use %JSONImport(response) to populate the list properly (e.g., `callrequest.%JSONImport(response)`), or- Loop through the list and set the property on each individual item, like this: For i=1:1:callrequest.emailAttachmentList.Count() { Set callrequest.emailAttachmentList.GetAt(i).attachmentClass = "application/xml" }
go to post Ashok Kumar T · Jul 14 The name property is Property name As HS.FHIRModel.R4.SeqOfHumanName; and the SeqOfHumanName class have Property list As %Library.DynamicArray;This list property holds the object of HS.FHIRModel.R4.HumanName
go to post Ashok Kumar T · Jul 11 Hello @Scott Roth I hope the target is a object reference of HS.FHIRModel.R4.Patientand the "name" property in in R4.Patient is an object property(HS.FHIRModel.R4.SeqOfHumanName ) and thisSeqOfHumanName stores the %DynamicArray of HS.FHIRModel.R4.HumanName object values into property called "list" So, First we have to check the name is $IsObject(r4Patient.name)&&(r4Patient.name.%IsA("HS.FHIRModel.R4.SeqOfHumanName")) and if it's true you can iterate the list (%DynamicArray) Set iter = r4Patient.name.list.%GetIterator() You can directly copy and run this example directly and it works for me. ClassMethod ParseHumanName() { Set r4Patient = ##class(HS.FHIRModel.R4.Patient).%New() ; Set seqHuman = ##class(HS.FHIRModel.R4.SeqOfHumanName).%New() ; create human name for seqHuman Set human = ##class(HS.FHIRModel.R4.HumanName).%New() Set human.family="pil" Set human.text="Ashok,kumar" ; ;push the HumanName into SeqOfHumanName Do seqHuman.add(human) ; Set SeqOfHumanName into Patient.name Set r4Patient.name = seqHuman If $IsObject(r4Patient.name)&&(r4Patient.name.%IsA("HS.FHIRModel.R4.SeqOfHumanName")) { Set iter = r4Patient.name.list.%GetIterator() #; while iter.%GetNext(,.humanName) { zw humanName.toDao() } } quit }