1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
509 views
by michael-h-5027 (14.8k points)
I want my sub folders to be based on some dateTime or some other HL7 field value but the sub folders do not currently exist.

1 Answer

+2 votes

If you wanted to make a sub folder based on date you could use something similar to this:

var year = qie.formatDate('YYYY', qie.deduceDate(source.getNode('MSH-7')));

var month = qie.formatDate('MM', qie.deduceDate(source.getNode('MSH-7')));

var folder = "" + year + "-" + month;

var fullPath = qie.evaluateTemplate("\\\\ServerName\\Test-ADT\\New folder\\{c:folder}\\");

var fullPathDirectory = new java.io.File(fullPath);

if (!fullPathDirectory.exists()) {

   fullPathDirectory.mkdirs();

}

messageCache.setValue('fullPath', fullPath);

 

 

For the destination node use the following:

{c:fullPath}\*.*

by michael-h-5027 (14.8k points)
edited by mike-r-7535
by chris-m-8014 (760 points)
I had to modify 2 lines in the above code to make it work.

var fullPath = qie.evaluateTemplate("\\\\ServerName\\Test-ADT\\New folder\\{c:folder}\\");
...became...
var fullPath = qie.evaluateTemplate("\\\\ServerName\\Test-ADT\\New folder\\" + folder + "\\");

and

{c:fullPath}\*.*
...became...
{mc:fullPath}\*.*
...