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.
As an example, suppose there is a data source defined in the configuration called Customer which addresses a CustomerDetails table in a database. The following fillpoint would cause the values in the database to be changed:
SetDataSourceData('Customer',CustomerID,'Fullnames',concat(FirstNames, ' ', LastName),'PreferredLanguage',IIf((Lang = ''),'English',Lang))»
This fillpoint will cause the following actions:
- 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 as below.
- 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.
- 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’.
Up to 10 pairs of ColumnName,Value pairs can be specified in one call to SetDataSourceData.