You can create extended attributes whose values depend on the values
of other attributes. These can be read-only or read and write.
The following scripts provide a means for reading and writing the value from the standard
Name attribute into a calculated extended attribute:
Get Script |
Set Script |
Function %Get%(obj)
%Get% = obj.GetAttribute("Name")
End Function
|
Sub %Set%(obj, value)
obj.SetAttribute "Name", value
End Sub
|
The following scripts read the value of the computed
FileGroup extended
attribute from the
filegroup physical option, and write back to the
physical attribute:
Get Script |
Set Script |
Function %Get%(obj)
%Get% = obj.GetPhysicalOptionValue("on/<filegroup>")
End Function
|
Sub %Set%(obj, value)
obj.SetPhysicalOptionValue "on/<filegroup>", value
End Sub
|
The following script reads the value of the name of the database associated with the PDM
into the read-only Database extended attribute defined on the table metaclass:
Get Script |
Set Script |
Function %Get%(obj)
%Get% = obj.GetAttribute("Parent.Database.Name")
End Function
|
[none] |
The following script evaluates the value of the
Number attribute of a
table to set the boolean
BigTable extended attribute:
Get Script |
Set Script |
Function %Get%(obj)
%Get% = obj.GetAttribute("Number") > 99999
End Function
You
can use the following syntax to more explicitly set the
boolean:Function %Get%(obj)
Dim value
If obj.GetAttribute("Number") > 99999 then
value = true
Else
value = false
End if
%Get% = value
End Function
|
[none] |
The following script evaluates the value of the
Number attribute of a
table to set a text
TableSize extended attribute:
Get Script |
Set Script |
Function %Get%(obj)
Dim value
If obj.GetAttribute("Number") < 10000 then
value = "Small"
ElseIf ((obj.GetAttribute("Number") > 9999) and (obj.GetAttribute("Number") < 100000)) then
value = "Medium"
ElseIf ((obj.GetAttribute("Number") > 99999) and (obj.GetAttribute("Number") < 1000000)) then
value = "Large"
Else
value = "Very Large"
End if
%Get% = value
End Function
|
[none] |