locked
Received File Name in Map RRS feed

  • Question

  • How to get the Received File Name(using FILE.ReceivedFileName property)  in BizTalk Map. Kindly provide with suggestions.


    Regards, Vivin.

    Tuesday, May 20, 2014 1:24 PM

Answers

  • try this

    http://blogit.create.pt/blogs/tiagooliveira/archive/2009/02/02/Using-xpath-function-in-orchestrations.aspx

    xpath(msgOut,"string(xpathquery)")=msgIn(FILE.ReceivedFileName)

    You can't promote that field which occurs multiple times so in that case we use xpath()

    Regards



    • Edited by Rohit Shahi Thursday, May 22, 2014 5:15 AM
    • Marked as answer by Vivin Muthu Thursday, May 22, 2014 1:30 PM
    Thursday, May 22, 2014 5:11 AM
  • The problem with that is you still have multiple matching nodes (looping) and the xpath function works with a single node at a time.

    So, you would have to loop on the number of ReceivedFileName targets and use a index in the xpath.

    Another option is to create a new Message with the ReceivedFileName as a element, then use a multi-input map.  There, you would just link ReceivedFileName to the target node.

    • Marked as answer by Vivin Muthu Thursday, May 22, 2014 1:30 PM
    Thursday, May 22, 2014 1:10 PM

All replies

  • Here are some options:

    1. Use a Context Accessor Functoid:

    http://adifferentkindofquery.wordpress.com/2013/04/08/improved-context-accessor-functoid/

    http://contextaccessor.codeplex.com/

    2. Map a temp value to the target field, then in an Orchestration use either a Distinguished Field or the xpath() function to set the target element/atttribute to FILE.ReceivedFileName from the incoming message.

    3. Map a temp value to the target field, set it as a Promoted Property to FILE.ReceivedFileName and use the XmlAssembler's Property Demotion feature to set the value in the Send Pipeline.

    Tuesday, May 20, 2014 1:33 PM
  • In my case the map is being called from an orchestration, kindly advice the suitable solution for the same if possible with an example.

    Regards, Vivin.

    Wednesday, May 21, 2014 4:51 AM
  • Hi,

    In ur case , consider boatseller's 2nd point. He is trying to say that if u are trying to map receivedFileName to some node in the output message then in ur transform shape map some temp value to that node and after the mapping is done i mean after ur transform shape, by using Distinguished Field or the xpath() function set that node value to received file name.

    @boatseller : correct me if im wrong or missed something.

    Regards

    Wednesday, May 21, 2014 6:32 AM
  • Sorry to be such a party pooper, but although it might be a requirement to map an original file name, a clean loosely coupled integration solution should never be dependent on specific Adapters. In your case this Map will only work as long as you receive your message through a FILE Receive Adapter.

    You need to ask the following question: What would we do if, sometime in the future, we start receiving the same message type through other Adapters (such as Services, Database etc.) where no file name is available.

    Morten la Cour

    Wednesday, May 21, 2014 6:40 AM
  • Hi Rohit,

    Sorry but im not still clear on how it is to be done. Could u help me with an example?


    Regards, Vivin.

    Wednesday, May 21, 2014 6:44 AM
  • Suppose u need to map msgIn to msgOut. In msgOut u have a node "FileName", now in ur map assign any tmp value to this field like by using string concatenate functoid assign any constant value to "FileName".

    Now after this transform shape use MessageAssignment shape and by using xpath() or promote this "FileName" as Distinguished :

    msgOut.FileName=msgIn(FILE.ReceivedFileName)

    Note: both shapes are in same construct shape. This is the scenario if u need to map the file name to output msg.

    Regards


    • Edited by Rohit Shahi Wednesday, May 21, 2014 7:20 AM
    Wednesday, May 21, 2014 7:12 AM
  • Thanks Rohit for the explanation since I am new to BizTalk environment can u help me out in explaining how the promotion is done inside orchestration or by using xpath().

    Regards, Vivin.

    Wednesday, May 21, 2014 7:43 AM
  • Here is the screenshot of orchestration,

    The Transform_1 has the map file which is Source to Destination mapping.

    The Message Assignment shape has code as follows,

    SndOut.filename = RcvIn(FILE.ReceivedFileName);

    where RcvIn is my source schema and SndOut is Destination schema.

    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.


    Atul Toke

    Wednesday, May 21, 2014 7:45 AM
  • For Distinguished property promotion : Right click on the schema node which u want to promote -->> promote -->> Show Promotion. Now select the nodes u want to promote as Distinguished.

    http://msdn.microsoft.com/en-us/library/aa560697(v=bts.20).aspx

    Regards

    Wednesday, May 21, 2014 7:59 AM
  • Hi Rohit,

    Im not able to promote the node in the schema due to the message "This node can occur potentially multiple times in the instance document. Only nodes which are guaranteed to be unique can be promoted". Kindly advice how to use xpath and also what has to be done in the map with an example.


    Regards, Vivin.


    • Edited by Vivin Muthu Wednesday, May 21, 2014 9:19 AM
    Wednesday, May 21, 2014 9:18 AM
  • Adding to the above, in my solution im not using any pipeline component.

    Regards, Vivin.

    Wednesday, May 21, 2014 9:40 AM
  • In my case the map is being called from an orchestration, kindly advice the suitable solution for the same if possible with an example.

    All the listed options are valid for an Orchestration scenario.

    #2 is probably the easiest overall to implement.

    Wednesday, May 21, 2014 11:02 AM
  • Hi boatseller,

    Im not able to promote the node in the schema due to the message "This node can occur potentially multiple times in the instance document. Only nodes which are guaranteed to be unique can be promoted". Kindly advice how to use xpath.


    Regards, Vivin.

    Thursday, May 22, 2014 4:28 AM
  • try this

    http://blogit.create.pt/blogs/tiagooliveira/archive/2009/02/02/Using-xpath-function-in-orchestrations.aspx

    xpath(msgOut,"string(xpathquery)")=msgIn(FILE.ReceivedFileName)

    You can't promote that field which occurs multiple times so in that case we use xpath()

    Regards



    • Edited by Rohit Shahi Thursday, May 22, 2014 5:15 AM
    • Marked as answer by Vivin Muthu Thursday, May 22, 2014 1:30 PM
    Thursday, May 22, 2014 5:11 AM
  • Thanks for the reply rohit. Im getting  this error when using the xpath.

    Inner exception: The XPath expression '/*[local-name()='Insert' and namespace-uri()='http://Microsoft.LobServices.OracleDB/2007/03/Table/IBT_PUE_INTERCHANGE_HEADER']/*[local-name()='RECORDSET' and namespace-uri()='http://Microsoft.LobServices.OracleDB/2007/03/Table/IBT_PUE_INTERCHANGE_HEADER']/*[local-name()='IBT_PUE_INTERCHANGE_HEADERRECORDINSERT' and namespace-uri()='http://Microsoft.LobServices.OracleDB/2007/03/Table/IBT_PUE_INTERCHANGE_HEADER']/*[local-name()='PUIH_TEST_INDICATOR' and namespace-uri()='http://Microsoft.LobServices.OracleDB/2007/03/Table/IBT_PUE_INTERCHANGE_HEADER']' selected a node which is not valid for property or distinguished field retrieval, or it selected no node at all. Only text-only elements or attributes may be selected.


    Regards, Vivin.

    Thursday, May 22, 2014 6:25 AM
  • The problem with that is you still have multiple matching nodes (looping) and the xpath function works with a single node at a time.

    So, you would have to loop on the number of ReceivedFileName targets and use a index in the xpath.

    Another option is to create a new Message with the ReceivedFileName as a element, then use a multi-input map.  There, you would just link ReceivedFileName to the target node.

    • Marked as answer by Vivin Muthu Thursday, May 22, 2014 1:30 PM
    Thursday, May 22, 2014 1:10 PM