#1
|
|||
|
|||
![]()
Hi,
I'm calculating the channel execution time on the channel's postprocessor script. If I try to set a variable mapped to the channel's metadata using channelMap.put() from the channel postprocessor I get an invalid operation error. If I add the execution time using responseMap.put that works but the value doesn't appear in my metadata. Channel metadata looks like this: Column name=EXEC_TIME Type=NUMBER Variable Mapping=exec_time On my channel postprocessor script I tried channelMap.put('exec_time', 1234); This is the error for that: Wrapped java.lang.UnsupportedOperationException at 2de13d52-355c-481a-bd2f-9c43d7ff7d0c_Postprocessor:80 (doScript) at 2de13d52-355c-481a-bd2f-9c43d7ff7d0c_Postprocessor:85 at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:527) at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executePostprocessorScripts(JavaScriptUtil.j ava:255) at com.mirth.connect.server.transformers.JavaScriptPo stprocessor$JavaScriptPostProcessorTask.doCall(Jav aScriptPostprocessor.java:104) .... Then I tried: responseMap.put('exec_time', 1234); Execution is OK, but on the logs screen my metadata column EXEC_TIME is empty. How can I set metadata columns from a channel postprocessor? Thanks. |
#2
|
|||
|
|||
![]()
BTW I'm using 3.4.2
|
#3
|
|||
|
|||
![]() |
#4
|
||||
|
||||
![]()
I don't believe the channelMap is available in a post-processor. Populate your variable with a globalChannelMap and see if that works.
__________________
Best, Kirby Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified Appliance Version 3.11.4 Mirth Connect Version 3.8.0 Java Version 1.6.0_45-b06 Java (64 bit) Version 1.6.0_45-b06 Java 7 (64 bit) Version 1.7.0_151-b15 Java 8 (64 bit) Version 1.8.0_181-b13 PostgreSQL Version 9.6.8 |
#5
|
|||
|
|||
![]()
It is available for reading, but gives an exception when it's written.
IMO since the channel post processor is pay of the channel execution, the channel map should be available for writing channel metadata variables, like in my use case. GlobalChannelMap variables would be overwritten by multiple executions of thesame channel in parallel, wouldn't it? |
#6
|
||||
|
||||
![]()
You might want to take at the user guide.
"The map is isolated to the current message as it processes through the channel". You are trying this in the post-processor, The name post-processor makes me believe it is after processing. I haven't tested this, I could be wrong. As far as the globalMap, it depends on your configuration. This could be configured so messages don't overwrite the variables.
__________________
Best, Kirby Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified Appliance Version 3.11.4 Mirth Connect Version 3.8.0 Java Version 1.6.0_45-b06 Java (64 bit) Version 1.6.0_45-b06 Java 7 (64 bit) Version 1.7.0_151-b15 Java 8 (64 bit) Version 1.8.0_181-b13 PostgreSQL Version 9.6.8 Last edited by kirbykn2; 04-20-2018 at 09:01 AM. |
#7
|
|||
|
|||
![]()
The postprocessor is executed outside the channel scope - after the destination received the response (if any response is sent by the external system). This also means the metadata is already written at this point of time.
Thus, if you want to set a metadata that appears in the dashboard based on a value that is only available in the postprocessor, you can create a second, subsequent destination and write the value there to the channelmap. |
#8
|
|||
|
|||
![]()
Thanks Odo, that might work.
Is there a way to access the start/end dates in the channel source and destinations metadata? Mirth sets those values by default but it is not clear how to access those from script or transformer code in order to calculate execution times. Thanks |
#9
|
|||
|
|||
![]()
It seems timestamps from channel metadata can't be accessed from JS code.
|
![]() |
Tags |
channel, metadata, postprocessor |
Thread Tools | |
Display Modes | |
|
|