Question

I am using Mirth 3.0. I am having a file having thousands of records. The txt file is having 3 liner header. I have to skip this header. How can I do this. I am not suppose to use batch file option.

Thanks.

Was it helpful?

Solution

If there is some method of identifying the header records in the file, you can add a source filter that uses a regular expression to identify and ignore those records.

OTHER TIPS

Such result can be achieved using the Attachment script on the Summary tab. There you deal with a message in its raw format. Thus, if your file contains three lines of comments and then the first message starts with the MSH segment you may use regular JavaScript functions to subtract everything up to MSH. The same is true about the Preprocessor script, and it's even more logical to do such transformation there. The difference is that the Mirth does not store the message before it hits the Attachment handler, but it stores it before the Preprocessor handles the message.

Contrary to that, the source filter deals with the message serialized to the E4X XML object, where the serialization process may fail because of the header (it depends on the inbound message data type settings).

As a further reading I would recommend the "Unofficial Mirth Connect Developer's Guide". (Disclaimer: I'm the author of this book.)

The answer is a real simple setting change which you need to make. I think your input source data type is delimited text.

Go to your channel->Summary tab->Set data type->Source 1 Inbound Properties->Number of header record set it to 3.

What mirth will do is, to skip the first 3 line records from the file as they will be considered as headers.

In my implementation the header content remains same so in advance I know how much lines the header is going to take so inside source filter I am using the following code.

delete msg["row"][1];delete msg["row"][1];return true;

I am using delete statement twice becoz after executing the first delete statement MSG will be having one less row and if header accommodates more that a single row then second delete statement is required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top