242014Sep

Derived Property In ATG

Derived Property In ATG is a transient property (not associated with a column in a table) that:

  • Derives its value from another property
  • Can search through a series of properties to find a non-null value
  • Specifies the derivation mechanism in the XML Repository Definition File by using a <derivation> tag

Derived properties provide a way for you to point toward different property values within the same object to derive a default value when an initial value is not available for that particular property.
You can look at property values in the same item descriptor that the current values reside in, or at subproperty values within the same object.
Any value that is accessible to that object is available for derivation, and no code needs to be written to enable this flexibility. This provides you with the maximum amount of flexibility in obtaining values for properties with a minimal amount of extra coding effort.

derivation Tag

  • The <derivation> tag enables you to specify one or more properties from which to derive the current property’s value.
  • This tag uses <expression> tags to list the properties to look through for a value.
  • Both the derived property and the expressions must be of the same type.
  • By default, the repository returns the value of the first property in the list that is not null.
<item-descriptor name="user">
<table .... >
	<property name="initialDownloadNumber" datatype=" int"/>
	<property name="myDownloadNumber" data-type="int"/>
</table>
<property name="downloadNumber" writable="false">
	<derivation>
		<expression>myDownloadNumber</expression>
		<expression>initialDownloadNumber</expression>
	</derivation>
</property>
</item-descriptor>

In the example above, one item property is derived from another.

  • The myDownloadNumber and initialDownloadNumber properties are non derived properties that are set explicitly.
  • The downloadNumber property is transient and is nonwritable because its value is derived (rather than set explicitly).
  • When it is requested, the value of myDownloadNumber is returned if it is non-null; otherwise, initialDownloadNumber is returned.