Question
· Mar 31, 2017

Ensemble Business Operation: FileOperation - File Naming

Is there a way to use a HL7 field value as part of the File Naming in the Business Operation FileOperation class.  I know we can do this in a custom class, but I was wondering if it could be done the default FileOperation class?

Example:

MSH-4 contains the value 12345

We would like to name the file 12345_YYYYMMDDHHMMSS.HL7

MSH.4 value here_%Y%m%d%H%M%S.HL7

It may not be possible, but I just want to see if anyone has any information

Thanks,

Kevin Brown

Discussion (3)1
Log in or sign up to continue

I think the only property that can be used to create the filename is Source which contains the original file name. That is included by specifying %f in the output file.

You *could* steal that and put the value of MSH-4 in HL7.Source in some DTL in the routing engine.

Hijacking fields is never elegant and it can always bite you later when someone tries to use it for its original purpose, but ...

You could create a custom operation based on EnsLib.HL7.Operation.FileOperation, modifying (or replacing) the value of pFilename used in the outputDocument() method. You can get the specific field value you want to include in the filename with pDcocument.GetValueAt("<some_field_identifier>").

In your specific case, it could be as simple as inserting the following as the first line of the outputDocument() method:

    Set pFilename = pDocument.GetValueAt("MSH:4")_pFilename

Of course, you might want to take the precaution of making sure MSH:4 is actually populated before updating pFilename, and have it do something useful if it's not :)