Examples of substitution
This topic contains examples of valid syntax that can be used in substitution expressions.
- Example 1:
{id.123.response.TCRMPersonBObj.PartyId}Gets the PartyId from the TCRMPersonBObj object. The TCRMPersonBObj object comes from the response that has a correlator ID 123.
- Example 2: This example shows the most basic form of substitution
expression.
{id.222.response.TCRMPersonBObj.TCRMPersonNameBObj[where NameUsageType = 1]. PersonNameIdPK}Gets the PersonNameIdPK from the TCRMPersonNameBObj object where the NameUsageType equals 1. The TCRMPersonBObj object comes from the response that has a correlator ID 222.
- Example 3: This example shows the use of criteria to compare a numeric
value.
{transactionCorrelatorId.222.TCRMPersonBObj.TCRMPersonNameBObj [where LastName = 'Smith'].PersonNameIdPK}Similar to example 2, when the
.responsesymbol is omitted, the response object is assumed. Also, you can use transactionCorrelatorId instead of id. The symbol transactionCorrelatorId is retained for backwards compatibility purposes. - Example 4: This example shows the use of criteria to compare a string
value.
{id.111.request.TCRMPersonBObj.TCRMPartyAddressBObj[2].StartDate}Gets the StartDate from the third TCRMPartyAddressBObj object. The TCRMPersonBObj object comes from the request that has a correlator ID 111.
- Example 5: This example shows the use of criteria by
index.
{id.333.response.TCRMPersonBObj.TCRMPartyContactMethodBObj[where PartyContactMethodIdPK = 9900].TCRMPartyContactMethodPrivPrefBObj [where EndDate = date('2005-12-31 12:00:00.000')].StartDate}Gets the
StartDatefrom theTCRMPartyContactMethodPrivPrefBObjobject whose end date is equal to the date specified. TheTCRMPartyContactMethodPrivPrefBObjobject belongs to theTCRMPartyContactMethodBObjobject whosePartyContactMethodIdPKequals9900. TheTCRMPersonBObjobject comes from the response that has a correlator ID333. - Example 6: This example shows the use of criteria in more than one object in the object
hierarchy. It also shows the use of criteria to compare a date
value.
{id.444.response.TCRMPersonBObj.TCRMPersonNameBObj[where NameUsageType != 1 and PrefixType = 12].LastName}Gets the
LastNamefrom theTCRMPersonNameBObjobject where theNameUsageTypedoes not equal1andPrefixTypeequals12. TheTCRMPersonBObjobject comes from the response that has a correlator ID444. - Example 7: This example shows the use of boolean and comparison operators to create more
complex
criteria.
Gets the{id.555.response.TCRMPersonBObj.TCRMPersonNameBObj[where NameUsageType = id.200.request.TCRMPersonBObj.TCRMPersonNameBObj.NameUsageType].LastName}LastNamefrom theTCRMPersonNameBObjobject where theNameUsageTypeequals the NameUsageType from theTCRMPersonNameBObjobject in the request that has a correlator ID200. TheTCRMPersonNameBObjis a part of theTCRMPersonBObjobject from the response that has a correlator ID555.This example shows that the right-hand side of a comparison operator can be a fully qualified name that refers to another part of the composite transaction. In previous examples, the right-hand side value is a constant.
- Examples 8-12: The following are some examples of substitution that are not valid, and
will cause exceptions to be thrown either during parsing or
transaction.
{id.555.response.TCRMPersonBObj.TCRMPersonNameBObj[where id.200.request.TCRMPersonBObj.TCRMPersonNameBObj.NameUsageType = NameUsageType].LastName}This example is similar to example 7, except that the left-hand side and right-hand side values of the comparison operator are reversed. The syntax requires that the left-hand side value be an attribute of the object being qualified. By definition, an attribute name cannot contain any period, hence an exception will be thrown during parsing time.
{id.234.response.TCRMPersonBObj.TCRMPartyAddressBObj[2]}This example is syntactically incorrect because the last symbol in the substitution cannot be qualified with an index. An exception will be thrown during parsing time.
{id.234.response.TCRMPersonBObj.TCRMFinancialProfileBObj}This example is syntactically correct and can be parsed successfully. However, this substitution does not evaluate to a value since
TCRMFinancialProfileBObjis a business object. The backward reference used in the substitution expression must resolve to an attribute. This example will throw an exception at transaction time.{id.234.response.TCRMPersonBObj.TCRMPersonNameBObj[where LastName = Smith]. PersonNameIdPK}This example is syntactically incorrect because the string value being compared is not enclosed with quotation marks. An exception will be thrown during parsing time.
{id.234.response.TCRMPersonSearchResultBObj.PartyId}This example is syntactically correct and can be parsed successfully. However, if the request producing this response is an
searchPersontransaction, the transaction will return zero or more instances of theTCRMPersonSearchResultBObjobjects in a collection. By not qualifying whichTCRMPersonSearchResultBObjobject you want to refer to, this example will throw an exception at transaction time. - Example 13: This example shows the correct way to refer to any out-of-the-box attribute
from an object that has been extended. You must point to the Extension object. Create an XML
composite transaction and use substitutions
In a substitution path with multiple extended objects, the first must be a custom object. Any following objects can be either out-of-the-box or extended.
For example, if TCRMContractBObj is extended, use the following to get a value from the getContract transaction response (bold type indicates a custom object).id.111.response.ContractExtensionBObjExt[0].TCRMContractComponentBObj[0].TCRMContractPartyRoleBObj[0].PartyIdNote: Because contractpartyrole is extended, the following would be expected, but will fail:
The issue is not with the extended object (contractpartyrole). The following is correct:id.111.response.ContractExtensionBObjExt[0].TCRMContractComponentBObj[0]. ContractPartyRoleExtensionBObjExt[0].PartyId
But the following will fail:id.111.response.ContractPartyRoleExtensionBObjExt[0].PartyIdid.111.response.TCRMContractPartyRoleBObjExt[0].PartyId