To adjust a datetime by subtracting five hours or 18,000 seconds (5 hours * 60 minutes * 60 seconds) in an HL7 Data Transformation, you can use ObjectScript utilities designed for time manipulation.
-
Using ConvertDateTime function: InterSystems provides the
ConvertDateTime()utility inEns.Util.Time. Example:Set NewDate = ##class(Ens.Util.Time).ConvertDateTime("20201224161922", "%Y%m%d%H%M%S", "YYYYMMDDHHMISS")This function allows you to manipulate date formats and apply operations on datetime values [1].
-
Time zone library: There's also a specialized library for converting and handling time zones with both HL7 formatted times and adjustments. An example of subtracting a specific duration (5 hours in your case):
Set datetime = "20201224161922" Set newDatetime = ##class(Ens.Util.Time).SubtractSeconds(datetime, 18000) ; Subtracting 18,000 seconds (5 hours)This will yield
20201224111922[2].
These approaches can be used directly in your transformation logic for accurate date-time operations. If using time zones or further functionalities, refer to the utilities within InterSystems' interoperability tools or libraries [1][2].
Sources:
To make the Ens.ScheduleHandler alert on error, you need to configure your Ensemble production appropriately. Ens.ScheduleHandler interacts with Ens.Alarm and other components to manage scheduled start and stop times for production items.
To enable alerts, you might employ the Ens.Alert or similar mechanisms already available in InterSystems IRIS/Ensemble systems. You could configure the components linked to Ens.ScheduleHandler and trigger alerts based on specific error scenarios.
Messages between Ens.ScheduleHandler and Ens.Alarm ensure that components are started/stopped according to schedules. Errors or disruptions during this process could be monitored and alerts set up by designing rules in your systems for such sessions. This process uses the ensemble messaging system, which may require setting the proper parameters to retain scheduling-related messages and avoid purging them preemptively [1].
If you intend to integrate more robust error handling, consider subclassing relevant components and adding mechanisms to send alerts upon encountering specific exceptions, which might require adjustment to adapter settings or creating custom notification rules [2][1].
Sources:
The issue you're encountering with
<INVALID OREF>suggests that theidentifier.valueortarget.MRNis not a valid ObjectScript reference (OREF) during the operation. This happens if theidentifieris not properly initialized as an object. To address this issue, verify thatidentifiercontains a valid OREF before trying to access its propertyvalue. You can do this using$ISOBJECT.Here’s an example adjustment to your code:
This ensures the loop only processes
identifierobjects that are valid and avoids errors when working with null or invalid OREFs [1][2][3].Sources: