web stats
Mirth Calling VBScript - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2011, 02:52 PM
arronramsey arronramsey is offline
Mirth Newb
 
Join Date: Sep 2007
Posts: 13
arronramsey
Default Mirth Calling VBScript

Was wondering how i can get Mirth to call a VBScript? There is a similar post from 2006 but i can not figure it our using those instructions.

I would like to program message changes in VBScript, and Have Mirth call the VBScript to apply the changes to the message.

I have nothing against Java...I just don't know how to program with it.

Thanks for any help!
Reply With Quote
  #2  
Old 04-03-2011, 12:49 AM
AlexToft AlexToft is offline
OBX.3 Kenobi
 
Join Date: Sep 2010
Location: Leeds, UK
Posts: 160
AlexToft is on a distinguished road
Default

You can do it, but it would be horribly clunky and you'd most likely take a significant performance and functionality hit. It would involve writing the data out to somewhere the vbscript could access it, call the script, then read it back in from wherever the script puts the output. Might even require 2 channels to do it safely as once you've passed it outside Mirth it can no longer track the progress of the transformation; channel A receives data and writes it out to file/database, script processes data and saves it somewhere else, then channel B picks up up and sends it. You start getting to the point where using Mirth becomes largely redundant.

Don't confuse Java and Javascript; the use of the former is not necessary and is very different to the latter which is fairly trivial to use. There are enough Javascript samples out there that it largely becomes a copy/paste/tweak exercise providing you know some basic fundamentals such as variables, arrays, loops etc...
Reply With Quote
  #3  
Old 04-03-2011, 06:56 AM
arronramsey arronramsey is offline
Mirth Newb
 
Join Date: Sep 2007
Posts: 13
arronramsey
Default

Thanks for the reply. I was afraid of that.

2 more questions for you.

1. Are there any decent tutorials out there that show how to do the "bread and Butter" work that an interface engine does? It seems like every one on the web is dedicated to how to map to a database, or how to create a pdf. ...i'd just like to see how to copy one field to another, or how to concatenate 2 fields together....stuff like that.

2. If i was going to learn javascript and write scripts in the transformer, would i change the transformer step to "javascript" and put it there?
Reply With Quote
  #4  
Old 04-04-2011, 10:49 AM
AlexToft AlexToft is offline
OBX.3 Kenobi
 
Join Date: Sep 2010
Location: Leeds, UK
Posts: 160
AlexToft is on a distinguished road
Default

1. You'll find lots of info on Mirth basics on the wiki. When working with Mirth transformers you can simply paste a message in the template box then drag different elements into the panel. To map the ID in PID2 to PID3 you would use something like this; note you don't have to write any of this whatsoever, you just drag the fields across and it generates the descriptor for you.

Code:
msg['PID']['PID.3']['PID.3.1'] = msg['PID']['PID.2']['PID.2.1'].toString();
To cat 2 fields together is equally simple:

Code:
var myVar = msg['PID']['PID.2']['PID.2.1'].toString() + msg['PID']['PID.3']['PID.3.1'].toString();
msg['PID']['PID.2']['PID.2.1'] = myVar;
2. Just click the transformer type and you get a drop-down list. Select JavaScript.

Mirth is very friendly, but it doesn't absolve you from needing to know some computing basics such as loops, variables, arrays etc. A lot of common functions can simply be dragged across from the reference pane, then you edit the template to suit your needs.

Last edited by AlexToft; 04-04-2011 at 10:51 AM.
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 -8. The time now is 01:30 AM.


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