Jay
Jay

Reputation: 14471

Setting the output file name in a biztalk send port

Good afternoon,

I'm trying to set the output file name in a send port and the available file name macros won't quite work.

I need something of the form "file.YYYYMMDD_HHMMSS". There's a datetime combined macro (with the wrong format), a time only macro, but no date only macro.

I don't have an orchestration for this process.

Is there any way I can set the file name from within a map or a pipeline?

Thanks!

Upvotes: 2

Views: 10585

Answers (4)

Lobsang Gyatso
Lobsang Gyatso

Reputation: 51

You can achieve filename in this format YYYYMMDD_HHMMSS using following.

Use expression shape in orchestration and create four variables.

varDateTime=System.DateTime.Now; //varDateTime is datetime type
strDate=varDateTime.ToString("yyyyMMdd"); //strDate is string type
strTime=varDateTime.ToString("HHmmss"); //strTime is string type
outboundfilename= ""+strDate + " _  " +strTime +" "; //outboundfilename is the string variable.

Use the following code in Message Assignment Shape

msgOutbound(FILE.ReceivedFileName)=outboundfilename+".xml";
//File extension can be any based on your requirement. I have xml file type.

You don't need custom pipeline to do this.

Upvotes: 5

zurebe-pieter
zurebe-pieter

Reputation: 3266

This can be set by setting the FILE.ReceivedFileName (instead of BTS.ReceiveFileName).

Upvotes: 3

Rajesh Ramabathiran
Rajesh Ramabathiran

Reputation: 176

You can create a custom pipeline component to be placed on the send side (say encode stage), and then set the BTS.ReceiveFileName property to the custom file name value that needs to be set.

After this is done, you can use the %SourceFileName% macro in the Send Port. You can also refer to this MSDN forum link for more details

Upvotes: 3

silverbugg
silverbugg

Reputation: 39

You can do it with a custom pipeline or an orchestration but not with a map. Info on building a custom pipeline can be found here:

BizTalk MSDN Blogs

Upvotes: 2

Related Questions