web stats
Creating a transform step for Current Date - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2012, 09:56 AM
psanders psanders is offline
OBX.1 Kenobi
 
Join Date: Nov 2011
Posts: 41
psanders is on a distinguished road
Default Creating a transform step for Current Date

Hi all,

I need to populate the MSH.7.1 in my output message with the current date and time.

I'm not familiar enough with how the transform steps work outside of dragging and dropping from the message trees.

So I thought I could simply drag MSH.7.1 from the outbound message template tree to the Variable text field on the left, and it does populate it. Then I thought I could drag the "Get Current Date" from the References tab and drop it into the Mapping text field on the left, and I'd be set.

But that's not right as I get a warning: "The variable name contains invalid characters. Please enter a new variable name."

I guess I'm not sure how to fix the warning and get the current date populated in the field I need it to.

What is the right way to do this?
Attached Images
File Type: jpg Mirth_Warning.jpg (30.6 KB, 18 views)
Reply With Quote
  #2  
Old 04-18-2012, 10:52 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 3,529
narupley is on a distinguished road
Default

That Mapping field basically requires an RHS (right hand side) expression. Try the following:

Code:
DateUtil.getCurrentDate('yyyyMMddHHmmss')
Reply With Quote
  #3  
Old 04-18-2012, 11:21 AM
upstart33 upstart33 is offline
Mirth Guru
 
Join Date: Dec 2010
Location: Chicago, IL.
Posts: 415
upstart33 is on a distinguished road
Default

When building HL7 messages, I use something like the following Javascript transformer step:

Code:
var startDate = DateUtil.getCurrentDate("yyyyMMddHHmm");

tmp['MSH']['MSH.7']['MSH.7.1'] = startDate
Reply With Quote
  #4  
Old 04-18-2012, 01:26 PM
psanders psanders is offline
OBX.1 Kenobi
 
Join Date: Nov 2011
Posts: 41
psanders is on a distinguished road
Default

I guess I still don't understand, trying to follow your suggestions.

I've attached another picture. I still get the same error.

I appreciate the help
Attached Images
File Type: gif Mirth_Warning_2.gif (13.2 KB, 31 views)
Reply With Quote
  #5  
Old 04-18-2012, 01:57 PM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 3,529
narupley is on a distinguished road
Default

Quote:
Originally Posted by psanders View Post
I guess I still don't understand, trying to follow your suggestions.

I've attached another picture. I still get the same error.

I appreciate the help
Just remove the "var startDate = " and the semicolon at the end.
Reply With Quote
Reply

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 -7. The time now is 05:58 PM.


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