GetFieldProtection()
Summary
Gets a string that indicates whether a field is read-only.
Syntax
field_protection_flag = GetFieldProtection(string field_spec)
| Argument | Contents |
|---|---|
| field_spec | A field spec |
Returns
The string "True" if the field is read-only; the string "False" if values for this field can be modified.
Notes
-
If a field is protected, the user cannot change its value in an editor. Other operations in Caliper Script, like SetRecordValues(), can still change its value.
-
Some fields are always protected. These include the linking fields in a joined view (see JoinViews() and JoinViewsMulti()), any aggregation fields (see SelfAggregate(), JoinViews(), and JoinViewsMulti()), any expression fields (see CreateExpression()), and any field on a view that is entirely read-only (see GetViewReadOnly()).
-
SetFieldProtection() can change the status of a field which is not always read-only (see above).
Example
prot = GetFieldProtection("SalesRep.Salary")
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The input field specification is ambiguous |
| NotFound | The input field does not exist |
See Also
| Function | Summary |
|---|---|
| GetFieldInfo() | Returns the data type, display width, decimals, and index flag for a field |
| GetReadOnlyFields() | Gets a list of the read-only fields in a view |
| GetViewReadOnly() | Reports whether a view is read-only |
| SetFieldProtection() | Changes the read-only status of a field |