Search

July 4, 2017

SetDataSourceData

Values in databases can be changed by the user in the interview using the various “Save” options as described in Control how the user can change data source data.

The template author can also instruct XpressDox to modify values in a data base, using the SetDataSourceData function.

 

Example 1: Write the entire dataset into a database record as an XML blob

«SetDataSourceData('MatterData',MatterID,'Data',GetDataSet())»

Where MatterData is the name of the data source, MatterID is the configured ID, and GetDataSet() is a function which returns the assembled dataset and in this example is being written into the field ‘Data’.

 

 

Example 2: Write certain fields back into a database

«SetDataSourceData('Customer',CustomerID,'Fullnames',concat(FirstNames, ' ', LastName),'PreferredLanguage',IIf((Lang = ''),'English',Lang))»

Where Customer is the  configured data source. The following events will happen as a result of the above fillpoint:

  1. The row in the CustomerDetails table with a key whose value is in the CustomerID data element will be retrieved, and the values of the Fullnames and PreferredLanguage columns in that row will be modified.
  2. The value of the Fullnames column will be built up from the values of the FirstNames and LastName data elements, with a space between them (concat function).
  3. The value of the PreferredLanguage column will be set to the value of the Lang data element, if it has a value, otherwise the PreferredLanguage column will be set to ‘English’.

 

 

Note: Up to 10 pairs of ColumnName,Value pairs can be specified in one call to SetDataSourceData.