web stats
A question on mapping CSV tables into the global channel - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2018, 06:24 AM
J R J R is offline
Mirth Newb
 
Join Date: Nov 2017
Posts: 18
J R is on a distinguished road
Default A question on mapping CSV tables into the global channel

Can I refer to them bidirectionally? Meaning if I have 1 outbound interface and 1 inbound interface using the same set of data but referring to the opposite sides of the pair, can I use a single table to do that?

Right now I have a working .csv table for inbound transactions formatted like this:

physician mnemonic,internal ID

I then pull it into the $gc using a deploy script:
Code:
$gc('PhysICGuidtoTUGID',{});
for each (pair in org.apache.commons.io.FileUtils.readFileToString(new java.io.File('C:/Mirth/TableMaps/PhysICGuidtoTUGID.csv')).split('\r\n|\r|\n'))
	$gc('PhysICGuidtoTUGID')[pair.split(',')[1]] = pair.split(',')[0];

return;
I grab the internal ID column based on the physician mnemonic below:
Code:
var pv171 = msg['PV1']['PV1.7']['PV1.7.1'].toString().toUpperCase();

if ($gc('PhysICGuidtoTUGID')[msg['PV1']['PV1.7']['PV1.7.1'].toString().toUpperCase()])
	{
		pv171 = $gc('PhysICGuidtoTUGID')[msg['PV1']['PV1.7']['PV1.7.1'].toString().toUpperCase()];
		msg['PV1']['PV1.7']['PV1.7.1']=pv171;
	}
This works great. My question is, can I reuse this same table to pull data the other way using the Internal ID to get the Mnemonic?
Reply With Quote
  #2  
Old 07-13-2018, 08:59 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 330
agermano is on a distinguished road
Default

Is this what you mean?
Code:
$gc('PhysICGuidtoTUGID',{});
$gc('TUGIDtoPhysICGuid',{});
for each (pair in org.apache.commons.io.FileUtils.readFileToString(new java.io.File('C:/Mirth/TableMaps/PhysICGuidtoTUGID.csv')).split('\r\n|\r|\n')) {
	pair = pair.split(',');
	$gc('PhysICGuidtoTUGID')[pair[1]] = pair[0];
	$gc('TUGIDtoPhysICGuid')[pair[0]] = pair[1];
}
return;
FYI, mirth also includes FileUtil in their User API that allows you to replace
Code:
org.apache.commons.io.FileUtils.readFileToString(new java.io.File('C:/Mirth/TableMaps/PhysICGuidtoTUGID.csv'))
with
Code:
FileUtil.read('C:/Mirth/TableMaps/PhysICGuidtoTUGID.csv')
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 05:54 AM.


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