Page 1 of 1

Extract number from .txt File & Rename

Posted: Thu Jul 24, 2008 3:01 pm
by MillerTimeHI
I need to extract a number from text files (HL7 v2.3 Healthcare files if anyone is familiar) and rename the file based on that number. Below is an example and the number I need to extract (AcctNum) is located where the 88888888 is. The number of text pipes will always be the same, the AcctNum will always be in the 19th position within the the line segment, which will always start with PID.

MSH|^~\&|SENDINGAPP|45|RECEIVINGAPP|HOSP|20080531210531||ADT^A03|Q123459789T123456789|P|2.3
EVN|A03|20080531210500|||ABC1234^DOE, RN^JANE^A^^^^^^CD:123456
PID|1|1234567|123456|12345|MOUSE^MINNY^J||12345678000000|F||H|1234 1ST AVE^^DISNEY WORLD^FL^99999||8005551234|8005551234|ENG|M|XYZ|88888888|123456789||||FLORIDA||0

I am not a programmer and will appreciate any help you can give me!

Re: Extract number from .txt File & Rename

Posted: Fri Jul 25, 2008 9:42 pm
by DataMystic Support
You need to first use a pattern match to extract this field and save it in a global variable.

Then use a scripting filter to capture all the data and save it to a new file using the FileSystem object.

Re: Extract number from .txt File & Rename

Posted: Fri Aug 01, 2008 7:44 am
by MillerTimeHI
Could you please provide me an example of how to do this with your program & the script? I tried to do it on my own but am still struggling. I would appreciate help from any of you hard working programmers; I'm sure this is simple in your world. Thx.

Re: Extract number from .txt File & Rename

Posted: Fri Aug 01, 2008 12:09 pm
by DataMystic Support
We'd have to do this as a small consulting job - no more than 1 hour. Please drop us an email if you'd like to do so.