go to post Enrico Parisi · Dec 27, 2023 I found the problem. The issue does not happen if the service user is changed using: IRISinstall.exe setserviceusername <instance-name> <username> <password> When that command is issued two groups are created: IRISServicesIRIS_Instance_<InstanceNme> and the service user is added as member of there two groups. The reason that it works using this way is that to the IRISServices group, in Local Security Policy is assigned the "Replace a process level token" user right. In other words, the user that stars IRIS need the "Replace a process level token" right assigned via Local Security Policy (or GPO in an AD Domain). Lesson learned:- Use IRISinstall.exe to change the user for the IRIS serviceor- Assign "Replace a process level token" right to the user of IRIS service
go to post Enrico Parisi · Dec 17, 2023 Set sc=##class(%File).GetDirectorySpace("D:",.FreeSpace) Write FreeSpace Classreference: classmethod GetDirectorySpace(Name As %String, ByRef FreeSpace As %String, ByRef TotalSpace As %String, Flag As %Integer = 1) as %StatusReturn the amount of total space and free space in either Bytes,MB,GB on a drive or directoryName = Valid Drive or directory specificationFlag = 0 - Return bytesFlag = 1 - Return MB (Default)Flag = 2 - Return GB MB and GB returned are rounded to 2 decimal places.Any error status returned is O/S level error. Note that on Windows only drives have a measurement for free space and directories can not so the FreeSpace is only returned for drives.
go to post Enrico Parisi · Dec 14, 2023 Please note that "%PosixTime values have a 1 microsecond resolution", see %Library.PosixTime class reference documentation. Then:USER>set ts="2023-12-12 19:46:19.000" USER>set Posix=##class(%Library.PosixTime).TimeStampToLogical(ts) USER>write ##class(%Library.PosixTime).LogicalToTimeStamp(Posix-18000000000)2023-12-12 14:46:19 Enrico
go to post Enrico Parisi · Dec 12, 2023 Using correct length of 16 characters for IV and 32 characters key. This Javascript: var iv = CryptoJS.enc.Hex.parse("00000000000000000000000000000000");var stringyouWantToEncrypt = "HelloWorld";var base64Key = "RXJjb2xpbm9zZW1wcmVpbnBpZWRpMDEyMzQ1Nzg5MDE=";var encrypted = CryptoJS.AES.encrypt( stringyouWantToEncrypt, CryptoJS.enc.Base64.parse(base64Key), { iv: iv, }) And this ObjectScript: Set text="HelloWorld"Set IV=$c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)Set KEY = "RXJjb2xpbm9zZW1wcmVpbnBpZWRpMDEyMzQ1Nzg5MDE="Set KEY=$SYSTEM.Encryption.Base64Decode(KEY)Set text=$ZCONVERT(text,"O","UTF8")Set sCrypt=$SYSTEM.Encryption.AESCBCEncrypt(text,KEY,IV)Set sToken=$SYSTEM.Encryption.Base64Encode(sCrypt)Write !,!, "Encoded -> "_sToken Both return the same: Encoded -> 2s4qbUJC6romvsp7TP2L4A== Enrico
go to post Enrico Parisi · Dec 8, 2023 Use foreach action to loop DRGgrp() and inside the loop insert an if action to the check if = "PMP", use break action when found. If you need more detail, provide a sample HL7 message and specify what you need to do after finding it. Enrico
go to post Enrico Parisi · Dec 8, 2023 Use foreach action to loop DRGgrp() and inside the loop insert the check. Enrico
go to post Enrico Parisi · Dec 7, 2023 I don't think you can implement it in a messaging routing rule. Personally I would implement it using code, writing a Business Process class. Another option is using a BPL business process, but I'm not a fan of BPL. But probably that's just me. 😊 Enrico
go to post Enrico Parisi · Dec 6, 2023 I would create my "custom" datatype extending %Library.DateTime: Class Community.dt.CustomDateTime Extends %Library.DateTime { ClassMethod LogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ] { Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val) Quit $translate(%val,"TZ"," ") } ClassMethod XSDToLogical(%val As %String) As %TimeStamp [ ServerOnly = 1 ] { Set $e(%val,11)="T" Quit ##class(%Library.TimeStamp).XSDToLogical(%val) } } Then in your class define your property as: Property OPDT As Community.dt.CustomDateTime; Are you sure you really need %Library.DateTime and not %Library.TimeStamp?The difference is the JDBC/ODBC format. From the documetation: %DateTime is the same as %TimeStamp (is a sub-class or %TimeStamp) with extra logic in the DisplayToLogical and OdbcToLogical methods to handle imprecise datetime input T-SQL applications are accustomed to. If you prefer using %Library.TimeStamp, then change the superclass in my sample code. After that: USER>Set reader = ##class(%XML.Reader).%New() USER>Set sc=reader.OpenString("<NewClass2><OPDT>2023-11-30 11:07:02</OPDT></NewClass2>") USER>Do reader.CorrelateRoot("Samples.NewClass2") USER>Do reader.Next(.ReturnObject,.sc) USER>Do ReturnObject.XMLExport(,",indent") <NewClass2> <OPDT>2023-11-30 11:07:02</OPDT> </NewClass2> USER>Write ReturnObject.OPDT 2023-11-30 11:07:02 USER> Enrico
go to post Enrico Parisi · Dec 5, 2023 You have setup your REST Web application "Allowed Authentication Method" as "Unauthenticated", therefore your REST code/application runs under the "UnknownUser" account/user. My guess is that the UnknownUser user does not have enough privilege (Role(s)) to run your code.If this is just a private, isolated test system, try adding %All role to the UnknownUser user account. Enrico
go to post Enrico Parisi · Dec 4, 2023 Maybe you can find some useful info in this two Global Summit 2023 sessions: OAuth 2.0 Fundamentals OAuth 2.0 in Practice with InterSystems Products Enrico
go to post Enrico Parisi · Dec 3, 2023 Hi Anna, the error you are getting is due to the missing (not started) Java Gateway using port 55555.You can get your sample working starting the default java gateway using the Management portal System Administration -> Configuration -> Connectivity -> External Language Servers, there you can customize the "%Java Server" and start it.Note that the default "%Java Server" uses port 53273, so if you want to use it, you need to change 55555 with 53273, or you can define and start your own Java Server using port 55555. Please note that you are using a legacy feature that should work for backward compatibility but it's no longer documented (the documentation page you have linked before editing your question is from Ensemble 2018, not IRIS).The new documented way to call external languages, including Java, is using InterSystems External Servers ($system.external) The following is a rewrite of the old version sample described in this page using the new External Server for Java that implement the same functionality. Set paramsJSON="{""origin"" : ""philadelphia"", ""destination"" : ""boston""}" ; Get the Java Gateway, if needed this will also start the gateway. ; You may need to configure Java Home from Management Portal: ; System Administration -> Configuration -> Connectivity -> External Language Servers ; there you can cofigure the "%Java Server" Set jgw=$system.external.getJavaGateway() Do jgw.addToPath("/path/to/jars/gson-2.10.1.jar") Set inputJSON=jgw.new("com.google.gson.JsonParser").parse(paramsJSON) Set jsonObject = inputJSON.getAsJsonObject() Set origin = jsonObject.get("origin").toString() Set destination = jsonObject.get("destination").toString() Set URLsource=jgw.new("java.net.URL","http://maps.googleapis.com/maps/api/directions/json?origin="_origin_"&destination="_destination_"&sensor=false") Set in=jgw.new("java.io.BufferedReader",jgw.new("java.io.InputStreamReader",URLsource.openStream(),"UTF-8")) Set outputJSON=jgw.new("com.google.gson.JsonParser").parse(in) Do in.close() Set jsonObject = outputJSON.getAsJsonObject() Set response = jsonObject.toString() ; just for testing write the output to terminal Write response Please note that this sample does not require any Java side code, just the libraries/jars used in the sample.For complex Java code a Java side wrapper class (or classes) can be developed to simplify the IRIS/Java interface. HTHEnrico
go to post Enrico Parisi · Dec 1, 2023 I'm afraid you cannot use the syntax shortcut () within a StrReplace function.You can use the () syntax to assign a constant string to ALL the repeating fields, like: <assign value='"PDF"' property='target.{PIDgrpgrp().ORCgrp().OBXgrp().OBX:ValueType}' action='set' /> In your case you need to iterate in each of the 3 repeating segments using foreach actions, like: <foreach property='source.{PIDgrpgrp()}' key='k1' > <foreach property='source.{PIDgrpgrp(k1).ORCgrp()}' key='k2' > <foreach property='source.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp()}' key='k3' > <assign value='..ReplaceStr(source.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp(k3).OBX:ValueType},"ED","PDF")' property='target.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp(k3).OBX:ValueType}' action='set' /> </foreach> </foreach> </foreach> Enrico
go to post Enrico Parisi · Dec 1, 2023 Hi Ian, I guess in the copy/paste something went wrong 😉Same code with different formatting: ClassMethod ValidNHS(pNHS As %String = "", Output pFailReason) As %Boolean { IF pNHS'?10N { set pFailReason = "Num" Quit 0 } set nCheckdigit = $Extract(pNHS,10,10) set nChi9Digits = $Extract(pNHS,1,9) set nMultFact = 2 set nCalcCheckdigit = 0 for i = 9 : -1 : 1 { set nThisDigit = $Extract(nChi9Digits,i,i) set nCalcCheckdigit = nCalcCheckdigit + (nThisDigit * nMultFact) set nMultFact = nMultFact + 1 } set nCalcCheckdigit = (nCalcCheckdigit # 11) set nCalcCheckdigit = 11 - nCalcCheckdigit if (nCalcCheckdigit = 10) { set pFailReason = "ChkDig" Quit 0 } if (nCalcCheckdigit = 11) { set nCalcCheckdigit = 0 } if (nCheckdigit = nCalcCheckdigit) { set pFailReason = "" Quit 1 } Else { set pFailReason = "ChkDig match" Quit 0 } }
go to post Enrico Parisi · Nov 30, 2023 Check the Filename setting in your Business Operation: Enrico
go to post Enrico Parisi · Nov 30, 2023 I would create my "custom" datatype extending %Library.DateTime: Class Community.dt.CustomDateTime Extends %Library.DateTime { /// Converts the %TimeStamp value to the canonical SOAP encoded value. ClassMethod LogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ] { Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val) Quit $translate(%val,"TZ"," ") } } Then in your class define your property as: Property OPDT As Community.dt.CustomDateTime; Are you sure you really need %Library.DateTime and not %Library.TimeStamp?The difference is the JDBC/ODBC format. If you prefer using %Library.TimeStamp, then change the superclass in my sample code. Enrico
go to post Enrico Parisi · Nov 29, 2023 Hi Emil,I can think of 3 possible approaches. 1) Use XPATH2) Modify the XML Document as a DOM3) Use XSLT transformations All 3 can be used/implemented in IRIS. Enrico P.S.: I suggest using the latest version of the documentation
go to post Enrico Parisi · Nov 28, 2023 Maybe the %JSONImport method is returning an error? To find it out change this two lines:do pResponse.%JSONImport(tHttpResponse.Data.Read())quit $$$OK With:quit pResponse.%JSONImport(tHttpResponse.Data.Read()) Then check the trace/event log. Enrico
go to post Enrico Parisi · Nov 27, 2023 If it's in the table, then can be viewed in the event log. All that page does is run a query against ENS_UTIL.LOG and display the result.From your screenshot the source config item should be ....RsltRouter, if not found in the list (I don't know why), you can just type it or omit it.