cordifed
cordifed

Reputation: 7

Skip element in BizTalk flat file assembly?

I've been tasked to map an input xml (actually an SAP idoc xml), and to generate a number of flat files. Each input xml may yield multiple output files (one output file per lot number), so I will be using xsl:key and the key() function in my mapping, based on the lot number

The thing is, the lot number itself will not be in the file itself, but the output file name needs to contain that lot number value.

So the question really is: can I map the lot number to the xml and have the flat file assembler skip it when it produces the file? Or is there another way the lot number can be applied as file name by the assembly without having it inside the file itself?

Upvotes: 0

Views: 108

Answers (2)

Jay
Jay

Reputation: 14441

In your orchestration you can set a context property for each output message:

msgOutput(FILE.ReceivedFileName) = "DynamicStuff";

msgOutput then goes to the send shape. In your send port you set the output file like this:

FixedStuff_%SourceFileName%.xml

The result:

FixedStuff_DynamicStuff.xml

Upvotes: 2

DTRT
DTRT

Reputation: 11040

  1. If the value is not required in the message content, don't map it. That's it.
  2. To insert at value in the file name, lot number in this case, you will need to promote that value to the FILE.ReceivedFileName Context Property. Then, you can use the %SourceFileName% Macro as part of the name setting in the Send Port. You can set FILE.ReceivedFileName by either Property Promotion or xpath() in an Orchestration.

Bonus: Sorting and Grouping in xslt is rather unwieldy, which is why I don't do that anymore. Instead, you can use SQL: BizTalk: Sorting and Grouping Flat File Data In SQL Instead of XSL

Upvotes: 1

Related Questions