go to post Jeffrey Drumm · Mar 25 There are a few issues with this code, but the biggest one is that you've created a clone and should be modifying the clone (pOutput) exclusively. However, you're still calling SetValueAt() against a segment pulled from pRequest. The above notwithstanding, you're still sending the original unchanged message object (pRequest) to the target operation with the SendRequestAsync() call. Fundamentally, you should: Create a clone of the request object pRequest (i.e. pOutput) Modify the clone, which is a mutable copy of the original message Send the modified clone (pOutput) to the target operation
go to post Jeffrey Drumm · Mar 25 The code sample you've provided above is pulling the OBX segment from pRequest, not the clone. pRequest is immutable so you can't make changes to it. You should be using the pOutput object for your SetValueAt() calls, and since it's a clone you can use it for the GetValueAt() calls as well. I provided pretty much everything you need to do this via a DTL in your other post on this subject. If you're worried about keeping things simple for ongoing support, the DTL solution is likely the better option.
go to post Jeffrey Drumm · Mar 21 A couple of thoughts ... In my experience, the pool of resources that can build complex integrations using the Health Connect GUI is an order of magnitude larger than those that can do the same in pure ObjectScript. The rarer the resource, the more it costs. I've also found that some of those that have used ObjectScript as a method to enhance/alter the behavior of production components have implemented "private" methods or relied on undocumented behavior that has the potential to change or become deprecated, requiring extensive testing and possibly re-coding when upgrading.
go to post Jeffrey Drumm · Mar 20 You can do this by creating a collection object in a code block, and iterate over the comma-separated string to populate it: Set tArray = ##class(%ArrayOfDataTypes).%New() For i = 1:1:$LENGTH(LookupVal,",") { Do tArray.SetAt($PIECE(LookupVal,",",i),i) } You can now iterate over the collection variable in the for each action:
go to post Jeffrey Drumm · Mar 17 Seems like the operation isn't working as it should; you may want to take this up with the WRC.
go to post Jeffrey Drumm · Mar 17 Looks like HealthConnect/IRIS for Health doesn't supply ISO-8859-4 ("Northern European"), or its successor ISO-8859-10. You can try forcing other character sets by preceding them with an exclamation point in the operation's Default Char Encoding property, but there may be characters that translate incorrectly:
go to post Jeffrey Drumm · Mar 15 Here's how I would approach this using a DTL ... Create a counter variable to hold the number of occurrences of "Item Number:" Use a for each action to iterate over the OBX segments In the for each, create an if action that checks for the presence of "Item Number:" in OBX:5 (using ..Contains()) If the action is true, increment the counter variable Example: On completion of the for each, you should have a value that indicates the presence of more than one "Item Number." Next, update the OBXs: Create another counter variable to track occurrences of "Item Number" to be used for comparison Add another for each action to perform the modifications to the OBX segments Use the $REPLACE() or ..Replace() functions to replace "REASON FOR REQUEST:" in each OBX:5 with an empty string Add an if action to check the OBX:5 field for "Item Number:"; increment the new counter variable if found Add an if action to evaluate the new counter variable against the original; if it's less than the original, add a line break (not actual $C(13)/$C(10) characters, but escaped representation such as \.br\ or \X0D\\X0A\; likely vendor-dependent) Example:
go to post Jeffrey Drumm · Mar 13 While you can create multiple productions in a single namespace, you can only run one at a time. There's really no good reason to have more than one production in a namespace ... and with each production in its own namespace, they can be running concurrently.
go to post Jeffrey Drumm · Mar 11 Do you get a different result with this? SELECT COUNT(*) FROM Ens.MessageHeader WHERE ID >= (SELECT TOP 1 ID FROM Ens.MessageHeader WHERE TimeCreated >='2025-02-01 00:00:00.000' ORDER BY TimeCreated ASC) AND ID <= (SELECT TOP 1 ID FROM Ens.MessageHeader WHERE TimeCreated <='2025-02-28 23:59:59.999' ORDER BY TimeCreated DESC) AND ID = SessionId
go to post Jeffrey Drumm · Mar 11 That's odd. I obtained the same results from both queries on my system; the only difference was the speed of execution. The subquery model from my example is the same one used behind the scenes by InterSystems to select messages by date range in the message viewer. I can't imagine why you'd be getting different results.
go to post Jeffrey Drumm · Mar 8 I'm not seeing an example of your desired result(s) ... can you share that as well?
go to post Jeffrey Drumm · Mar 7 Likely significantly faster: SELECT COUNT(DISTINCT SessionId) FROM Ens.MessageHeader WHERE ID >= (SELECT TOP 1 ID FROM Ens.MessageHeader WHERE TimeCreated >='2025-02-01 00:00:00.000' ORDER BY TimeCreated ASC) AND ID <= (SELECT TOP 1 ID FROM Ens.MessageHeader WHERE TimeCreated <='2025-02-28 23:59:59.999' ORDER BY TimeCreated DESC) In my crude and hasty benchmarking, twice as fast on a sampling of 2.7M message headers.
go to post Jeffrey Drumm · Mar 7 Inserting characters that are defined as HL7 delimiters to fields is likely to be problematic. It would be very helpful if you would provide an example of the source message and the desired result.
go to post Jeffrey Drumm · Mar 4 You can suspend the task via either ObjectScript or SQL. Assuming you know the Task ID, and using 1001 as an example: Set tsk = ##class(%SYS.Task).%OpenId(1001) Set tsk.Suspended = 1 Do tsk.%Save() or Do ##class(%SYS.Task).Suspend(1001,1) Resume the task with Do ##class(%SYS.Task).Resume(1001) Via SQL: UPDATE %SYS.Task SET Suspended = 1 WHERE ID = 1001 or UPDATE %SYS.Task SET Suspended = 1 WHERE TaskClass = 'Sample.Util.CreateTask' Set Suspended to 0 to re-enable the task.
go to post Jeffrey Drumm · Feb 25 Something like this should do the trick: ClassMethod GetConnectionStatus(pItemName As %String, ByRef pStatus As %String, ByRef pState As %String) As %Status [ Language = objectscript ] { Set tStatement = ##class(%SQL.Statement).%New() Set tSC = tStatement.%PrepareClassQuery("Ens.Util.Statistics","EnumerateJobStatus") Return:$$$ISERR(tSC) tSC Set tRS = tStatement.%Execute(pItemName) If tRS.%SQLCODE = 0 { Do tRS.%Next() Set pStatus = tRS.%Get("Status") Set pState = tRS.%Get("AdapterState") Return $$$OK } Return $$$ERROR(5001,"Status not Found") } Call it with the status and state variables passed by reference: Set sc=##class(My.Class).GetConnectionStatus("T_SPM_SIU",.status,.state)
go to post Jeffrey Drumm · Feb 17 @Enrico Parisi, I assumed that she wanted to purge the messages returned by this query: select * from Ens.MessageHeader nolockwhere timecreated < '2025-02-11 00:00:00.000'order by timecreated If they'd already been purged, there would be no headers returned.
go to post Jeffrey Drumm · Feb 17 If you're certain that you want to have those messages purged, you can run an UPDATE query against Ens.MessageHeader using the same criteria, but setting the Status field to 4 (Discarded). Status ID Created 1 Queued 2 Delivered 3 Discarded 4 Suspended 5 Deferred 6 Aborted 7 Error 8 Completed 9
go to post Jeffrey Drumm · Feb 15 The class Ens.MessageHeader has a classmethod Purge() that deletes message headers and bodies based on the number of days to keep along with a few other criteria; those are used in an SQL query to select the set of messages to purge. That query along with the associated purge code should work as an example to see what's involved in carefully removing messages without collateral damage ... search table indices need to be maintained, for example. There's also the Ens.Util.MessagePurge task definition that is used for scheduled purges, it has much of the same code but offers a multi-threaded purge feature that leverages the work queue. @Enrico.Parisi's solution moves the actual purge of the messages off to the scheduled Ens.Util.MessagePurge task for messages that exceed the DaysToKeep limit, as long as that is configured to delete bodies too. This is likely the safer solution and requires significantly less effort 😉
go to post Jeffrey Drumm · Feb 11 It's not recommended to do this with the included Apache web server, since it is now deprecated and will no longer be supplied with IRIS. However, you can install the Web Gateway component and configure it to use a standalone web server and enable SSL/TLS (https) on that. The documentation can be found through this link.
go to post Jeffrey Drumm · Feb 10 Does the operation have a job number in the Jobs tab on the right side of the Production page? That should correspond to the task's process ID in Windows. You should be able to terminate it with Task Manager or the taskkill command.