web stats
getReceivedDate() problem - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-04-2014, 01:40 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default getReceivedDate() problem

I have a problem retrieving the date a message was received at source from some code I am writing in a javascript response transformer.

I can use
Code:
connectorMessage.getReceivedDate()
, but this is the date that the message was picked by the destination, so I tried
Code:
message.getConnectorMessages().get(0).getReceivedDate()
but this throws and error.

Is this possible to do in the response transformer or do I need to get it earlier in the source transformer and save in the channelMap?

Simon
Reply With Quote
  #2  
Old 07-07-2014, 08:12 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

The "message" ImmutableMessage object is only available in the postprocessor. If you need to access something specific to a connector in a different connector's transformer, then yeah you'll have to store such information in the channel map.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 07-07-2014, 12:30 PM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

Nick, thank you for your prompt reply. If I were to save connectorMessage.getReceivedDate() in the channel Map would I be able to access it again as a calendar object? I mean, is it serializable so persists in the database should the message be reprocessed?
Reply With Quote
  #4  
Old 07-07-2014, 12:34 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by seaston View Post
Nick, thank you for your prompt reply. If I were to save connectorMessage.getReceivedDate() in the channel Map would I be able to access it again as a calendar object? I mean, is it serializable so persists in the database should the message be reprocessed?
That's right. It's serializable, so you'll still be able to access it as a Calendar object even if it gets persisted and later retrieved from the database.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #5  
Old 07-07-2014, 01:29 PM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

It's working perfectly now thanks, however I realized that I had to use a javascript step and not a mapper step to save the date as the mapper step appears to convert to a string.
Reply With Quote
  #6  
Old 10-22-2015, 06:47 AM
gazzerpiece gazzerpiece is offline
Mirth Newb
 
Join Date: Nov 2014
Posts: 9
gazzerpiece is on a distinguished road
Default Keep the Orig.ReceiveDate of message PROBLEM

Sorry but i don't understand very well.

How can i use the origine receive date of message?

The Postprocessor is at the end of flow message and the dates are not visible before from mapping.

Anyway ImmutablMessage.getReceiveDate() is also Deprecated!!
Is there an alternative way?

Thanks


PS i work with mirthconnect 3.2.2.7694

Last edited by gazzerpiece; 10-22-2015 at 06:57 AM. Reason: update mirth version
Reply With Quote
  #7  
Old 10-26-2015, 12:40 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

Put this in the source transformer then you can use it later...

Code:
channelMap.put("ReceivedDate",connectorMessage.getReceivedDate());
Reply With Quote
Reply

Tags
date, getreceiveddate, received, response

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:06 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation