locked
Issue with the BizTalk Mapping RRS feed

  • Question

  • I have two input csv files one for the Member and One for the Benefit they look like below enter image description here

    Both the inputs have EmployeeID field. I need to map both the files in to one output like each member with their Benefit

    12,MEMBER,007609952,007609952,12,05
    12,BENEFIT,MEA,001,0100189
    12,BENEFIT,DEN,002,0100189
    14,MEMBER,004482352,004482352,14,05
    14,BENEFIT,DEN,002,0100189
    14,BENEFIT,MEA,001,0100189
    14,BENEFIT,MEA,001,0100189
    14,BENEFIT,DEN,002,0100189
    

    This is my map enter image description here But this throws the output like

    12,MEMBER,007609952,007609952,12,05
    12,BENEFIT,MEA,001,0100189
    12,BENEFIT,DEN,002,0100189
    ,,,,
    ,,,,
    ,,,,
    ,,,,
    14,MEMBER,004482352,004482352,14,05
    12,BENEFIT,MEA,001,0100189
    12,BENEFIT,DEN,002,0100189
    ,,,,
    ,,,,
    ,,,,
    ,,,,
    

    I have other question on the same issue. But this one I tried to check with the small file and tried different ways of mapping. But the output the above output is what I am getting finally.  Any help with this is greatly appreciated

    Thursday, January 12, 2017 3:10 PM

Answers

  • Hi,

    You can achieve your requirement by using Global variable and inline C# code in BizTalk Map.

    The following is the code you can place in the Scripting Functoids respectively.

    Scripting 1: -(Declaring Global Variable)

    string EID;
    
    public void InitGlobals()
    {
    EID = "";
    }

    Scripting 2:- (Assigning EID for the Member)

    public string MyConcat(string EmpID)
    {
    EID = EmpID;
    	return EID;
    }

    Scripting 3:- (Checking the Matching Benefits for that EID)

    public bool MyConcat1(string EmppID)
    {
      if(EmppID == EID)
    {
    return true;
    }
    else
    {
    return false;
    }
    }

    Equal Functoid:-(Connect Equal to Benefit record node in output)

    Condition1 - Scripting

    Condition2 - true

    Connect both looping functiods from input record node to output record nodes of Benefit and Member's, all the other are one to one mapping.

    I have tested this map and it worked, Hope this helps.

    Thanks,

    Sarva.


    • Edited by SarvaSetty Thursday, January 19, 2017 4:35 AM
    • Marked as answer by vdha Thursday, January 19, 2017 9:27 PM
    Thursday, January 19, 2017 4:34 AM

All replies

  • Hi vdha,

    If I were you, I would have Open the BizTalk map in Visual studio right clicked the map and selected Validate Map which would have generate the XSLT as per the current mapping and the n I would have enhanced that XSLT to match my expected result. Use that XSLT and debugged the map/XSLT and see if it gives me the expected output and keep trying until I get the expected result.

    https://alamnaushad.wordpress.com/2012/03/03/biztalk-map-using-custom-xslt/


    Rachit Sikroria (Microsoft Azure MVP)

    Thursday, January 12, 2017 6:38 PM
    Moderator
  • Hi,

    I think both record node at the source side and destination side are unbounded so you do not need to have a looping around the record node , Once to one mapping of the element will work .

    Another option is to generate xslt  by making a validation and map the source and destination by Xpath value of the elements .  


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Friday, January 13, 2017 2:22 PM
  • Hi,

    You can achieve your requirement by using Global variable and inline C# code in BizTalk Map.

    The following is the code you can place in the Scripting Functoids respectively.

    Scripting 1: -(Declaring Global Variable)

    string EID;
    
    public void InitGlobals()
    {
    EID = "";
    }

    Scripting 2:- (Assigning EID for the Member)

    public string MyConcat(string EmpID)
    {
    EID = EmpID;
    	return EID;
    }

    Scripting 3:- (Checking the Matching Benefits for that EID)

    public bool MyConcat1(string EmppID)
    {
      if(EmppID == EID)
    {
    return true;
    }
    else
    {
    return false;
    }
    }

    Equal Functoid:-(Connect Equal to Benefit record node in output)

    Condition1 - Scripting

    Condition2 - true

    Connect both looping functiods from input record node to output record nodes of Benefit and Member's, all the other are one to one mapping.

    I have tested this map and it worked, Hope this helps.

    Thanks,

    Sarva.


    • Edited by SarvaSetty Thursday, January 19, 2017 4:35 AM
    • Marked as answer by vdha Thursday, January 19, 2017 9:27 PM
    Thursday, January 19, 2017 4:34 AM
  • Awesome. Thanks a ton Sarva. It worked fantastic.
    Thursday, January 19, 2017 9:28 PM