none
How to add and multiple two values in orchestration without mapping RRS feed

  • Question

  • Hi there,

    I have schema which have 3 different fileds 

    1) State

    2) number1

    3) number2

    i want route the message based on State value .

    for example

    1) if state == 'TN'  , i want routing message to one location and i need to "multiple" values of number1 and number2  into result filed .

    2) if state == 'HYD'  , i want routing message to one location and i need to "Add " values of number1 and number2  into result filed 

    how can i achieve this feat without  using any mapping , can we write any code in expression shape.

    Thanks and regards

    Ravinder Kampa

    Wednesday, July 26, 2017 10:53 AM

All replies

  • Don't know why you don’t mapping. Anyway..

    I read about..Distinguished Fields and Property promotion...to route the message to different process to handle it.

    Or if you want to do everything in one orchestration without using map (not sure whether I understood your question correct), use XPath extract the value of state,number1 and number2 and in the expression you can use if-statement (or you can use decide shape with different branch, mentioned if-statement because you wanted to write code in expression shape)

    if (state=="TN")
     {
       somevariable = number1 * number 2;
     }
    
     if (state=="HYD")
     {
       somevariable = number1 + number 2;
     }


    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.


    Wednesday, July 26, 2017 11:51 AM
  • how can i achieve this feat without  using any mapping , can we write any code in expression shape.

    Why don't you want to use a Map? That would be considered the "BizTalk Way" in most cases.

    There is no reason to not use a Map by the way.  If you describe this restriction, we can clarify the situation for you.

    Also, this may be a situation where the Business Rules Engine is the most appropriate.

    Wednesday, July 26, 2017 1:35 PM
    Moderator
  • Hi john,

    2 schema in my solution

    source schema 

    --name

    --state

    --number1

    --number2 

    dest shcema

    --name

    --state

    --result

    so my scenario  is if "state==tn" , two numbers should be multiple and if "state == HYD"  two numbers should be addition store result value in  dest result filed.

    if we want we can use 2 fields in dest schema but i want to achieve this by using 1 field only, can you help me out with an example.


    Wednesday, July 26, 2017 3:55 PM
  • Sorry, it's not clear what you're asking for...this is the same as what was described in the first post.

    Wednesday, July 26, 2017 5:18 PM
    Moderator
  • Hi,

    Easiest way is to do with the use of a map. Not sure why you insist on not using a map.

    Map Solution: 

    1) Drag a Equals Functoid. Connect the State Node To It.

    2) Drag a string Concatenate Functoid. Set the Value in It to TN

    3) Feed the output of the Concatenate Dunctoid To Equal.

    4) Drag a Multiply Functoid . Connect the Number1 and Number2 links to it.

    5) Drag a Value Mapping Functoid. Feed it the Output from Equal Functoid and Multiply functoid in same order. Connect output of Value mapping Functoid to result

    5) IF you have logic based only on "TN" and "HYD" only then, just put a Logical Not Functoid Now on Map.

    6) Feed it output from Equals Functoid.

    7) Drag Addition Functoid. Feed it Number1 and Number 2

    8) Drag a Value Mapping Functoid on Map and Feed it Output from Not and Addition Functoid and connect to result.

    This is the easiest and correct way to do things. The basic purpose of Map in BizTalk is to help achieve the transformation. If you use some code to achieve this simple scenario, that just defeats the purpose of Biztalk maps


    Mandar Dharmadhikari

    Thursday, July 27, 2017 12:29 AM
    Moderator