0
votes

actually i'm reading file in mirth connect>source transformer, configuration is as you see in below image. There is file in D:\yash.txt, and after reading i want to move them into same directly by placing _processed suffix before .txt file extension.

enter image description here

file read and processed okay,it generate filename like yash.txt_processed, is there a way, i can give name like yash_processed.txt, i don't want to give it directly, because i want that whenever i add file into drive, it automatically processed. Any help is appreciated.

2

2 Answers

4
votes

For your source connector create a JavaScript transformer step (click Edit Transformer) with the following code:

var srcFileName = sourceMap.get('originalFilename');
globalChannelMap.put('processedFile', srcFileName.replace(".", "_processed."));

Then, into the Move-To File Name: field place the newly created variable. So, instead of ${originalFilename}_processed it should be ${processedFile}

Try it now.

0
votes

you can do like this...

var data = "processed";
channelMap.put("test",data);

enter image description here

put this channel map variable in the file writer location.