Blog Stats
  • Posts - 17
  • Articles - 1
  • Comments - 6
  • Trackbacks - 22

 

Overwriting the %SourceFileName% macro to build dynamic filenames in BizTalk 2004…

I have a scenario where I receive a Purchase Order named as PO_.xml where ID is a unique identifier contained within the message. I need to send back POCAN_.xml or POACK_.xml through the same send port where ID is the same ID I received with the original PO. I could use a dynamic port to achieve this but I want to be able to define my transfer type at run time through a binding file. I also want to be able to support numerous transfer methods without changing any code.

 

The solution overwrite the %SourceFileName% macro.

 

Within a construct message block inside the orchestration use something like the following:

 

Message_2 = Message_1;

Message_2(FILE.ReceivedFileName) = ”POCAN_”+System.Convert.ToString(Message_1.id);

 

And then when you are defining the send port use File Name: %SourceFileName%.xml

 

VOLA

 

When  is %SourceFileName% actually populated with the source file name?

 

  • %SourceFileName% is only populated when the File adapter is used to read in the message (FILE.ReceivedFileName).
  • If a message was received on an adapter other than the File adapter, and it's value isn't overwritten as described above; the macro will not be substituted and will remain in the file name as is (for example, C:\Drop\%SourceFileName%).

** Added 10th Nov 2004 **

As an alternative Peter Himschoot has written the “Baptizer“ pipeline component to acheive this task take a look at "http://blog.u2u.info/DottextWeb/peter/archive/2004/11/09/319.aspx"


Feedback

# re: Overwriting the %SourceFileName% macro to build dynamic filenames in BizTalk 2004…

Gravatar Hi,
i read your description abt %SourceFileName%. I have a query:
I have created a send message "Testver7SendMsgInc"
and receive message named "Testver7RecMsgInc"

When i type the following code in the Expression Editor
Testver7SendMsgInc = Testver7RecMsgInc;

i get the following error:
Cannot implicitly convert type 'message Testver7Schemas.XMLInputFile1' to 'message Testver7Schemas.FlatFileSchema1'

And below it when i type:
Testver7SendMsgInc(FILE.ReceivedFileName) = System.Convert.ToString(Testver7RecMsgInc.ACTSEQ);

I get the following error:
identifier 'ACTSEQ' does not exist in Testver7RecMsgInc'; are you missing an assembly reference?

ACTSEQ is my child field element.
Well one thing i would to tell you is that my input schema ie XMLInputFile1 and output schema ie FlatFileschema1 and and map are in one project while orchestration which has both Testver7SendMsgInc and Testver7RecMsgInc in another project in the same solution. I have referenced my schema project in the orchestration project.
Pls tell me what is the problem.
Basically i want to get the value of ACTSEQ ie is a child field element, which i am getting from an XML file, to be shown as a name in my output file ie is a .txt file.

Pls specify what is wrong and what is the solution. my email id is: g12garg@gmail.com

Thanks
Gaurav Garg 12/14/2006 5:50 PM | Gaurav

# re: Overwriting the %SourceFileName% macro to build dynamic filenames in BizTalk 2004…

Gravatar hi,
i want change outputfile name form input message promoted field.
any one know the solution.pls help me
Thanks,
Tejash 6/17/2008 7:19 PM | Tejash Patel

Post a comment





 

 

 

Copyright © Nigel Parker