go to post Enrico Parisi · Jan 25 The sample you are posting does not work, %JSON.Adaptor is an abstract class and cannot be instantiated, so the line:set test = ##class(Test.Json).%New()returns <METHOD DOES NOT EXIST> error. In order to instantiate it you need to inherit from a non abstract class like %RegisteredObject, here is my test: Class Community.TestJSON Extends (%RegisteredObject, %JSON.Adaptor) { Property bool As %Boolean; } Then this is what I get: set test=##class(Community.TestJSON).%New() do test.%JSONExport() {} Another test: set test=##class(Community.TestJSON).%New() set test.bool=1 do test.%JSONExport() {"bool":true} I'm using IRIS 2023.3, same as yours. Maybe you have a different situation than the sample you posted?
go to post Enrico Parisi · Jan 25 I would like to thank InterSystems for trusting me and granting me this role.For me it's an honor to become a moderator in this passionate Community.
go to post Enrico Parisi · Jan 19 Hi Michael, this has been discussed in your previous question "INSERT OR UPDATE" here. Did you check my answer there? Does the class shown above (looks truncated) has a column that contains a unique constraint? Can you provide the rest of your class, in particular index definitions and the INSERT OR UPDATE statement you are using?
go to post Enrico Parisi · Jan 19 Just realized you need/want "the entry(0).resource", then: Set FirstResource=BundleObject.entry.GetAt(1).resource
go to post Enrico Parisi · Jan 19 Hi Antoine, you are right regarding inheriting from %Persistent and Ens.Request/Response, it does makes sense in many cases! I've edited my message to refer to your comment
go to post Enrico Parisi · Jan 19 Suppose you have your JSON in a stream StreamFHIR, then: Set BundleObject=##class(HS.FHIR.DTL.vR4.Model.Resource.Bundle).FromJSON(StreamFHIR,"vR4") If you want ONLY the first entry, then: Set FirstEntry=BundleObject.entry.GetAt(1)
go to post Enrico Parisi · Jan 18 First I'd suggest not to use a persistent class "linked" to a message (Ens.Response in this case), Supplier is linked by your message class in this case.If you do it, you will definitely create "orphaned" persistent objects when you purge, unless you add some logic (like triggers and callbacks) to delete the "linked" persistent objects when a message is purged. To avoid this (when possible) a serial class is preferred. So, the Supplier class would be: Class Community.App.Msg.Supplier Extends (%SerialObject, %XML.Adaptor) { Property row As %Integer; } As for the message class: Class Community.App.Msg.Suppliers Extends Ens.Response { Property Supplier As list Of Community.App.Msg.Supplier(XMLPROJECTION = "ELEMENT"); ClassMethod test() As %Status { set XmlString="<Suppliers><Supplier><row>1</row></Supplier><Supplier><row>2</row></Supplier></Suppliers>" set reader = ##class(%XML.Reader).%New() $$$ThrowOnError(reader.OpenString(XmlString)) do reader.CorrelateRoot("Community.App.Msg.Suppliers") do reader.Next(.Suppliers, .tSC) do Suppliers.XMLExport(,",indent") quit tSC } } For simplicity I modified the sample to be a classmethod.When the test() method is run the output is: EPTEST>d ##class(Community.App.Msg.Suppliers).test() <Suppliers> <Supplier> <row>1</row> </Supplier> <Supplier> <row>2</row> </Supplier> </Suppliers> The relevant documentation is "Controlling the Form of the Projection for Collection Properties" here. Let me add a few notes. If a class extend Ens.Response or Ens.Request is not necessary to extend %Persistent because is already inherited by Ens.Request/Ens.Response.Edit: please see Antoine commnet below If the desired XML tag correspond to the class name (without package), it is not necessary to add the XMLNAME parameter, like you did in App.Objects.Suppliers class. Same goes for XMLNAME property parameter XMLNAME = "row" is not necessary because the property name correspond to the desired XML tag name.
go to post Enrico Parisi · Jan 18 Did you specified in the classpath the path to ALL required (IRIS and yours) jars?Multiple path are separated by semicolon, looking at your post, in your case should be something like: /usr/iris/dev/java/lib/JDK18/;<something>/tomcat/webapps/GAPP/WEB-INF/lib/notificationEngine/slf4j-simple-1.7.36.jar
go to post Enrico Parisi · Jan 18 As you did in the wizard, you need to add/specify the classpath to "your" jars, this can be done in the java gw definition (and seems you didn't) or in your code when you connect to the java gw. The fact that it works after using the wizard (that add the javapath) suggest this may be the issue.
go to post Enrico Parisi · Jan 18 Did you add the classpath to the java gateway definition (not the import wizard) or added before you connect to the java gw?
go to post Enrico Parisi · Jan 18 Difficult to tell with the little info given. Can you please provide some more detail, ideally the code you use when you say "on trying to connect"?Did you include the classpath?
go to post Enrico Parisi · Jan 15 Optionally, instead of using IgnoreNull property of the reader, add to your M.PAT class: Parameter XMLIGNORENULL = 1;
go to post Enrico Parisi · Jan 15 Please check the documentation here regarding the IgnoreNull property of the reader.
go to post Enrico Parisi · Jan 14 Use a Utility Method: Develop a utility method within a class that inherits from Ens.Util.FunctionSet. This method would read the source config name from the first message header in the session. You can then use this method in your router logic as it will be automagically included. Custom utility functions used in DTL and Rules are defined in a class extending/inherits from Ens.Rule.FunctionSet, not Ens.Util.FunctionSet. As documented here.
go to post Enrico Parisi · Jan 14 OK, I think I understand the question! 😊 Suppose you want to put the "source" HL7 Message SourceConfigName in MSH:Security: <assign value='##class(Ens.MessageHeader).%OpenId($$$JobCurrentHeaderId).SourceConfigName' property='target.{MSH:Security}' action='set' /> In case you what to get the first message source config name: <assign value='##class(Ens.MessageHeader).%OpenId($$$JobSessionId).SourceConfigName' property='target.{MSH:Security}' action='set' />
go to post Enrico Parisi · Jan 13 With "Message Header" you refer to MSH segment or Ens.MessageHeader? Ens.MessageHeader properties cannot should not be modified.
go to post Enrico Parisi · Jan 13 The double-double quotes after .log? d $ZF(-100,"/SHELL /LOGCMD /STDOUT=/archive/logs/failover-intengtest-vip.log""",cmd)