There are many approaches to this. I’ll give the simple (or basic) way to do.
Set the FILE.ReceivedFileName and use the %SourceFileName% macro
In the orchestration Construct Message shape, add a Message Assignment shape and then you can set the FILE.ReceivedFileName property for your flat file message as so:
OutputMsg(FILE.ReceivedFileName) = System.DateTime.Now.ToString("yyyyMMdd") + ".txt"
This sets a context property that will then be used when you wire a static send port to your orchestration port. In your static send port, you specify the FTP adapter with a target file name like:
And the FTP adapter then replaces the %SourceFileName% macro, giving you a filename like “20101125.txt”
So whether you use the file or FTP adapter it is always FILE.ReceivedFileName you need to use.
4 thoughts on “BizTalk FTP Adapter – How to send an FTP message with a specified filename”
Urgent Direct Client Requirement
Position : BizTalk Architect
Location: Baton Rouge, LA, USA
Contract Type : Permanent hire
Required Skills :
Total IT exp of 10+years of exp
8+years of BizTalk experience in BizTalk 2004/2006/2006R2/2009
Excellent understanding and work experience on HIPAA and EDI
Either contract to Hire or permanent Hire
Please send the resume to : email@example.com
Can you also display the file recordcount. What I mean is after the filename can you add the record count for the said filename?
I don’t know if I quite understand your question, but inside orchestration you can configure the sourcefilename as you want.
You can calculate the number of records by using an expression something like: rcount = xpath(message, “count(….)”);
And then set the property FILE.ReceivedFileName like:
OutputMsg(FILE.ReceivedFileName) = “Some name” + rcount + “.txt”
I have done this in the past without an orchestration. I was picking up the messages into a SQL receive adapter, so I included the filename I wanted in my source schema. Then I let the XML assembler in the pipeline promote the filename field into the File.ReceivedFileName context property.
This would not work for all scenarios, but it suited my needs.