Not setting the value of the field using Vocabulary in Rule Composer tool

Hi All,

 I am facing an issue while testing the policy in Business Rule Composer tool.

The issue is while setting the schema element's value using Convert.Tostring(Vocabulary) inside Rule Action, it is not setting. Please check the below snap shot for more details.

 Schema i have used:

 

 The xml file used for testing:

<PurchaseOrder>
  <Header>
    <ReqID>ReqID_0</ReqID>
    <Date>Date_0</Date>
  </Header>
  <Item>
    <Description>Description_0</Description>
    <Quantity>200</Quantity>
  </Item>
  <Status>Inprogress</Status>
</PurchaseOrder>

Policy Used with vocabulary

While setting Quantity using Convert.ToString(SetQuanity) it is not setting but if I just use some numeric value  instead of Convert.ToString(SetQuanity), it is setting value.

Here Quantity in the schema is string but the Vocabulary SetQuanity is Integer.

Please let me know how Quantity can be set using Integer Vocabulary. Directly putting int vocabulary(SetQuanity) is throwing error  as i need to convert it.

And please also let me is there any way to find out what is going wrong if such kind of error occur, since

the output of the test result(below) is showing true but not setting the value.

RULE ENGINE TRACE for RULESET: ProcessPurchaseOrder 2/21/2015 7:55:06 PM

FACT ACTIVITY 2/21/2015 7:55:06 PM
Rule Engine Instance Identifier: 88301d3c-90f2-4e6c-8c98-5870466f1c77
Ruleset Name: ProcessPurchaseOrder
Operation: Assert
Object Type: TypedXmlDocument:PO - Copy
Object Instance Identifier: 56862858

FACT ACTIVITY 2/21/2015 7:55:06 PM
Rule Engine Instance Identifier: 88301d3c-90f2-4e6c-8c98-5870466f1c77
Ruleset Name: ProcessPurchaseOrder
Operation: Assert
Object Type: TypedXmlDocument:PO - Copy:/PurchaseOrder/Item
Object Instance Identifier: 42003681

CONDITION EVALUATION TEST (MATCH) 2/21/2015 7:55:06 PM
Rule Engine Instance Identifier: 88301d3c-90f2-4e6c-8c98-5870466f1c77
Ruleset Name: ProcessPurchaseOrder
Test Expression: TypedXmlDocument:PO - Copy:/PurchaseOrder/Item.Quantity <= 200
Left Operand Value: 200
Right Operand Value: 200
Test Result: True

FACT ACTIVITY 2/21/2015 7:55:06 PM
Rule Engine Instance Identifier: 88301d3c-90f2-4e6c-8c98-5870466f1c77
Ruleset Name: ProcessPurchaseOrder
Operation: Retract
Object Type: TypedXmlDocument:PO - Copy
Object Instance Identifier: 56862858

FACT ACTIVITY 2/21/2015 7:55:06 PM
Rule Engine Instance Identifier: 88301d3c-90f2-4e6c-8c98-5870466f1c77
Ruleset Name: ProcessPurchaseOrder
Operation: Retract
Object Type: TypedXmlDocument:PO - Copy:/PurchaseOrder/Item
Object Instance Identifier: 42003681

Please help me out.

Regards,

Joy

February 22nd, 2015 5:24am

Most likely it is because you have not enabled StaticSupport for the BRE. 

See here: https://msdn.microsoft.com/en-us/library/aa950269.aspx

Enabling StaticSupport means the BRE will invoke methods marked static without passing an instance of the class, Convert in this case where ToString is static.

  • Marked as answer by Joy_2101 11 hours 30 minutes ago
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2015 10:10am

Hi Joy.!

U can't compare string values with is "less than or equal" .

Best solution is, change your input schema node  "Quantity" to Numeric value then compare with values.! 

February 22nd, 2015 11:58am

Hi John,

 Thanks for you reply. 

Actually I am facing the same problem in my project, the above mentioned rule I have created to just replicate the issue.

We are upgrading our Biztalk project from 2006 to 2013. So in the other server where Biztalk 2006 is there, rules are executing properly.

 Biztalk 2013 we have installed in some other machine. So When i opened Registry I was not able to find StaticSupport  key, so I add that and assign value 1 but after that while I am testing the policy I am getting the error "Specified Cast is not valid".

And sorry I have attached some wrong snap shot, actual snapshot is below where in Condition section also I am doing casting. And both the vocabulary is integer.

Please let me know if i am missing anything else. 

Regards,

Joy

Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2015 1:42pm

Hi,

 Thanks for your reply. Sorry for attaching wrong snap, correct snap i have attached to my reply to John.As I mentioned this is an existing project(Biztalk 2006) , we are just upgrading to 2013. so I cant change the schema.

Might be I am missing some configuration. Please help me out if i need to do any other change.

Regards,

Joy

February 22nd, 2015 1:45pm

As per your mail i understood that, your testing in BizTalk 2013 environment.!

Can you check in BRE that ,your Node Deffincation of your node "xpath selecter" is correct ?

May be this is the reason, you might get "Specified Cast is not valid" error..!!

Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2015 3:31pm

Hi Madsri,

 the same rule I tried to import in Biztalk 2006 environment and it is working fine there, the quantity value is getting updated.

Node selector is looks like fine.

Regards,

Joy

February 22nd, 2015 4:07pm

A better way to handle it would be to change the Schema type to xs:int or similar and define a matching Vocabulary item.  Them you don't have to worry about converting anything.

Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2015 4:44pm

HI Joy,

Seems like ConvertToStrying is a .Net method, if that is .net method.! Gac or Deploy that .net method in your testing BizTalk 2013 environment and try.! 

Please mark as a answer if this post helps you.!

Thanks. 


February 22nd, 2015 6:54pm

Hi John,

 StaticSupport worked....I did a small mistake, instead of selecting DWORD i selected QWORD. Changing to DWORD works fine.

Thanks,

Joy

Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2015 6:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics