Xpath functions: data-source

Sometimes we need to combine data from different binding sources (i.e. data sections of the data source).

Below is an example of how to combine readings from different binding sources into a single expression.

The first two fields (1) point to MainData and GeneralData respectively.

Next, there is a field that uses the concat function to combine the two values into the final string (2). This is the expression:

concat(SalesInvoiceHeader/@BuyerName, ' AND ', data- source('GeneralData')/CurrentCompany/@Name, ' joined into one field.')

The Xpath expression is bound to MainData, so we need to use the data-source function to also read from GeneralData:

The third expression uses an iif function (inline if). As you can see, it switches between the document title and the company name based on the value of the boolean field @ShowPayer.

iif(data-source('MainData')/SalesInvoiceHeaderExt/Flags/@ShowPayer = 'true',

The binding source of this last expression can be set to any of the three data sections, since we use the data source function for all three parameters of the above expression.

Here is the template:
data-source.docx (98.8 KB)

1 Like