none
How to write the Expression in Biztalk RRS feed

  • Question

  • Hi,

    I have Decide shape in my orchestration . please refer below image 2.

    1. how to write the expression inside the rule expression editor of decide shape.

    2.i have to check error  code  node from  Response response . if it is 1 then will return the response back to client or else continue further process.


    ----------------------------------

    Thanks,

    Rajeshwari M.L


    Tuesday, September 6, 2016 6:22 AM

Answers

  • You have to check value using xpath.

    xpath(Receive_Login_Response,"string(/xpath)") == "1"

    You can get the xpath from schema element properties. To see the XPath for the given element/attribute, open the Schema in the BizTalk Schema Editor, select the element/attribute you want to get a value for, and in the properties window select the value for Instance XPath:


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, September 6, 2016 6:31 AM
    Moderator
  • Hi Abhay,

    How to  promote the Node X_ERROR_CODE AS distinguished promotion ?

    ------------------

    Thanks,

    Rajeshwari M.L

    Refer: Create the Distinguished Fields

    Right click on the field X_ERROR_CODE go to Promote -> Show Promotions contextual menu option of a message schema’s element.

    Once the dialog box is open, make sure that you are on the Distinguished Field tab, select the message elements and click the Add>>  to add distinguished fields.

    How to use distinguish field in orchestration? Refer: Using Distinguished Fields and Property Fields 


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, September 6, 2016 6:49 AM
    Moderator
  • Hi lakshmi,

    there is two way you can do this :

    first way by using xpath as Rachit already mentioned how you can do this.

    Second way , you can promote the Node X_ERROR_CODE AS distinguished promotion and then use the below syntex.

    Receive_Login_Response.X_ERROR_CODE=="1" 

    Tuesday, September 6, 2016 6:40 AM
  • Hi Rajeshwari

    Looks like the xpath expression below is not semantically correct-

    xpath(Response,"string (xpath of X_IMAGE)")

    Note that you need to provide the correct xpath expression of the X_IMAGE element in the bold part above.

    Note that the easiest way to get correct xpath expression for an element is to click that schema element in schema editor window in Visual Studio, and then copy the Instance XPath value directly (see below).

    So copy the Instance XPath value for that element, and replace the bold part below with that value-

    xpath(Response,"string (xpath of X_IMAGE)")

    Refer this article for the syntax.

    Same goes for the other xpath expression -  xpath(LoginResponseWithToken,"string (xpath of X_IMAGE)");

    For this, copy the xpath expression from LoginResponseWithToken message schema similarly and replace the part in bold above.


    Thanks Arindam




    Friday, September 16, 2016 2:41 PM
    Moderator

All replies

  • You have to check value using xpath.

    xpath(Receive_Login_Response,"string(/xpath)") == "1"

    You can get the xpath from schema element properties. To see the XPath for the given element/attribute, open the Schema in the BizTalk Schema Editor, select the element/attribute you want to get a value for, and in the properties window select the value for Instance XPath:


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, September 6, 2016 6:31 AM
    Moderator
  • Hi lakshmi,

    there is two way you can do this :

    first way by using xpath as Rachit already mentioned how you can do this.

    Second way , you can promote the Node X_ERROR_CODE AS distinguished promotion and then use the below syntex.

    Receive_Login_Response.X_ERROR_CODE=="1" 

    Tuesday, September 6, 2016 6:40 AM
  • Hi,

    there are multiple ways to do that;

    1) you can promote the  X_ERROR_CODE field in your schema and then you can access it by using dot expression like this; msgReceiveloginresponse. X_ERROR_CODE == "1" if it is string and msgReceiveloginresponse. X_ERROR_CODE == 1 if not string.

    2) using Xpath; xpath(msgReceiveResponse,"string(xpath of the field)") == "1"

    Sharad

    Tuesday, September 6, 2016 6:42 AM
  • Hi Rajeshwari,

    Check if your Login Response record is unbounded or not, usually the generated schema's response records are Unbounded but according to the use case/scenario of your work you can change it. Now if it is unbounded then use XPATH as suggested by Rachit else use Distinguished promotion as suggested by Abhay !!!

    Regards,

    Rahul Madaan

    Tuesday, September 6, 2016 6:48 AM
  • Hi Abhay,

    How to  promote the Node X_ERROR_CODE AS distinguished promotion ?

    ------------------

    Thanks,

    Rajeshwari M.L

    Refer: Create the Distinguished Fields

    Right click on the field X_ERROR_CODE go to Promote -> Show Promotions contextual menu option of a message schema’s element.

    Once the dialog box is open, make sure that you are on the Distinguished Field tab, select the message elements and click the Add>>  to add distinguished fields.

    How to use distinguish field in orchestration? Refer: Using Distinguished Fields and Property Fields 


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, September 6, 2016 6:49 AM
    Moderator
  • Hi Rajeshwari

    Looks like the xpath expression below is not semantically correct-

    xpath(Response,"string (xpath of X_IMAGE)")

    Note that you need to provide the correct xpath expression of the X_IMAGE element in the bold part above.

    Note that the easiest way to get correct xpath expression for an element is to click that schema element in schema editor window in Visual Studio, and then copy the Instance XPath value directly (see below).

    So copy the Instance XPath value for that element, and replace the bold part below with that value-

    xpath(Response,"string (xpath of X_IMAGE)")

    Refer this article for the syntax.

    Same goes for the other xpath expression -  xpath(LoginResponseWithToken,"string (xpath of X_IMAGE)");

    For this, copy the xpath expression from LoginResponseWithToken message schema similarly and replace the part in bold above.


    Thanks Arindam




    Friday, September 16, 2016 2:41 PM
    Moderator
  • That, and you're testing the equivalency of Object which will always be false.
    Friday, September 16, 2016 3:05 PM