How to use module properties in an XPath expression in BW 6.x.

How to use module properties in an XPath expression in BW 6.x.

book

Article ID: KB0075357

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

In BW 5.x, there exist an option in the Xpath editor to drag & drop the global variables and use them dynamically at runtime. In BW 6.x, the module properties replaces global variables and the list of module properties is not readily available in the Xpath editor.

Issue/Introduction

How to use module properties in an XPath expression in BW 6.x.

Resolution

To use the module properties in the XPath expressions, the built-in XPath function available in BusinessWorks 6.x studio that gets the value from the module properties and makes it available at runtime. 

Function Name: bw:getModuleProperty()
Syntax: getModuleProperty(<< modulePropertyName >>)

This article covers multiple scenarios based on the location of module property.

Case 1: Module property resides in the same application module and DOES NOT reside in any group or property folder:

Assume that 'MyProperty' is defined as string and value is 'MyPropertyValue'. You can use below example to access this property

getModuleProperty("MyProperty")
Returns = MyPropertyValue

Case 2: Module property resides in the same application module and resides in group or nested property folder:

For an instance, the property is configured as below:

'ParentFolder' (property folder) >> 'ChildFolder' (property folder) >> 'child_prop1' (String property)

To access this property, the XPath expression would be:

bw:getModuleProperty("/ParentFolder/ChildFolder/child_prop1")

Case 3: Module property resides in the shared module named 'SharedModule' and in the group or nested property folder:

Let's assume that following 2 properties are configured in 'SharedModule' as below,

#1: 'SharedModule_Group1' (property folder) >> newProperty (property)
#2: 'SharedModule_Group1' (property folder) >> 'SharedModule_Group2' (property folder) >> sm_Prop1 (property)

To access above properties in the application module i.e. across the modules, you can use below XPath expressions respectively:

bw:getModuleProperty("//SharedModule///SharedModule_Group1/newProperty")
bw:getModuleProperty("//SharedModule///SharedModule_Group1/SharedModule_Group2/sm_Prop1")

Additional Information

Along with this, check "TIBCO BW Predefined Module Properties" under the Constants section of the XPath editor.