«ReadOnly()» will cause the named data element (or list of data elements) to be shown in the interview, but their values will not be able to be changed by the user.
This is used typically where data are supplied from a data source (maybe via a ChooseFromDataSource command) and are displayed for information, but the user should not be able to change them.
With Version 6, the command can be applied conditionally. This will work particularly well in a situation where the data set is pre-populated with data identifying the user who is running the template (using Supervisor capabilities, or other mechanisms such as Standard Data in the Home Configurations). For example, suppose there is a user-related data element called Privileges and it contains a list of privileges like “ChangeData,OpenAccounts”. The following ReadOnly command will prevent users who may not change the data elements from changing that data:
The above means that the AccountNumber can not be changed by anyone, but AccountName can be changed if the user has the string ‘ChangeData’ in the Privileges data element.
Note that this command is available only in Version 4 and later of XpressDox.