Skip to main content
Solved

FSM XML Busines Rule

  • January 23, 2020
  • 6 replies
  • 485 views

Forum|alt.badge.img+7

I am trying to create XML business rule that exececutes on the Creation of a request

the business rule is expected to insert a a new line in a custom table for the most part it is working. but in one of the fields it need to combine the Place id with some text and im not sure how i would go about doing that the line question is the charge_code i would like it to insert S-22222-M where 22222 is the place id.

 

I tried the below but it populates exactly what is seen below if i put spaces around the @place_id it does populate the field with the 22222 but it also has a space on either side of the place_id.

Any help would be appriated 

 

Thanks

<perform_batch>
 <sequential_dependent>
 <update_rid_settlement regex_validated="true">
 <rid_settlement>
 <insert is_initialized="false" />
 <charge_group>STANDARD</charge_group>
 <cost_split>ALL</cost_split>
 <charge_code>S-@place_id-M</charge_code>
 <request_id>@request_id</request_id>
 </imax_rid_settlement>
 </update_rid_settlement>
 </sequential_dependent>
 </perform_batch>

 

Best answer by Mike The FSM TechnoGeek

Try this:

<perform_batch>
 <sequential_dependent>
 <update_rid_settlement regex_validated="true">
 <rid_settlement>
 <insert is_initialized="false"/>
 <charge_group>STANDARD</charge_group>
 <cost_split>ALL</cost_split>
 <charge_code>@expression["S-" + request.place_id + "-M"]</charge_code>
 <request_id>@request_id</request_id>
 </rid_settlement>
 </update_rid_settlement>
 </sequential_dependent>
</perform_batch>

 

View original
Did this topic help you find an answer to your question?

6 replies

Mike The FSM TechnoGeek
Superhero (Employee)
Forum|alt.badge.img+17

Try this:

<perform_batch>
 <sequential_dependent>
 <update_rid_settlement regex_validated="true">
 <rid_settlement>
 <insert is_initialized="false"/>
 <charge_group>STANDARD</charge_group>
 <cost_split>ALL</cost_split>
 <charge_code>@expression["S-" + request.place_id + "-M"]</charge_code>
 <request_id>@request_id</request_id>
 </rid_settlement>
 </update_rid_settlement>
 </sequential_dependent>
</perform_batch>

 


Forum|alt.badge.img+7
  • Author
  • Do Gooder (Customer)
  • 17 replies
  • January 24, 2020

Thank you very much that fixed my issue


Forum|alt.badge.img+7
  • Author
  • Do Gooder (Customer)
  • 17 replies
  • March 23, 2020

@Mike The FSM TechnoGeek  Thank you for your help previously. i have a new requirement to add to this. I now need to grab another field that is on the place table to use in the expression. say place.external reference. how would i go about adding that you the xml business rule i am assuming i need to do a hierarchy select against the place table but how would i add the result to the expression.

 

Thanks again for your help.

 

Graeme


Mike The FSM TechnoGeek
Superhero (Employee)
Forum|alt.badge.img+17

Graeme -

You can use the xpath attribute in the field tag for the field value to refer to previous results.  Have a look at this, fourth line from the bottom.

 

<perform_batch>
 <sequential_dependent/>
 <hierarchy_select result_name="SelectPlace01">
 <attrs>
 <attr>place.place_id</attr>
 <attr>place.external_reference</attr>
 </attrs>
 <primary_table>place</primary_table>
 <from>
 <table>place</table>
 </from>
 <where>
 <data_constraint>
 <constraint>
 <left_operand>place.place_id</left_operand>
 <operator>eq</operator>
 <right_operand>24379</right_operand>
 </constraint>
 </data_constraint>
 </where>
 </hierarchy_select>
 <update_rid_settlement regex_validated="true">
 <rid_settlement>
 <insert is_initialized="false"/>
 <charge_group>STANDARD</charge_group>
 <cost_split>ALL</cost_split>
 <charge_code>@expression["S-" + request.place_id + "-M"]</charge_code>
 <request_id>@request_id</request_id>
 <place_ext_ref xpath_node="//place_hierarchy_select_result[@result_name='SelectPlace01']/place/external_reference"/>
 </rid_settlement>
 </update_rid_settlement>
</perform_batch>

 


Forum|alt.badge.img+7
  • Author
  • Do Gooder (Customer)
  • 17 replies
  • March 23, 2020

@Mike The FSM TechnoGeek Thanks if I want use the xpath value in the expression instead of the request.place_id how would I update it

 

@expression["S-" + place.external_reference + "-M"]


Mike The FSM TechnoGeek
Superhero (Employee)
Forum|alt.badge.img+17

Pretty much just like that.  HOWEVER, you will need to have a custom metadata relationship defined (presumably) from the request table to the place table.  I suggest using a join type relationship.  Expressions are resolved for other tables via metadata relationships.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings