Page tree
Skip to end of metadata
Go to start of metadata

The purpose of this document is to explain the differences between the Item properties: CopyValueFrom, SynchronizedWith and InitialValue.

In order to be initialized in our framework, they first should be assigned in the *.Manager.Config.xml.

InitialValue (Item) property

  1. The Initial value (Item) property, specifies the default value assigned to the item when the record is created.
  2. The initial value doesn´t get assigned until the record is created in the block.
  3. The Initial value can be assigned in the *.Manager.Config.xml with the following items:
    - DatasetExpression
    - Summary
    - Item
    - GlobalVariable
    - TaskParameter
    - Constant
    - Formula
  4.  Property initialization:
    -  In the creation of a new row
    -  In the initialization of a SimpleBusinessObject 

In the *.Manager.Config,xml the default values can be configured as the following example (Item):

Initial value sample
<manager name="DEPT" logicalName="Dept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
  <items>
	  <item name="DESC" logicalName="Desc" type="System.String" physicalName="DESCRIPTION">
   		<value>
      		<item businessObject="EMP" name="EMPNO"/>
	    </value>
	  </item>
  </items>
</manager>

 

SynchronizeWith property

  1. The SynchronizedWith property, specifies the name of the item from which the current item should derive its value.
  2. With this property the values of the two items became synchronized/mirrored, any change performed in either items will trigger the changed of the other.
  3. The property synchronizedWith can only be assigned to an item that doesn´t have the synchronizedWith property already assigned.
    i.e. In the sample below, if the item "COUNTRY" had already a synchronizedWith property associated to him, we couldn´t synchronize the "DNAME" with the "COUNTRY". This means that there's no danger of incurring in a chain of synchronized items, much less a cycle of items the synchronize each other.
  4. Property initialization:
    - In the creation of a new row
    - In the initialization of a SimpleBusinessObject 
    - After query event of each loaded row
    - After the execution and load of the DataSet with its results

In the *.Manager.Config,xml the synchronizedWith can be configured as the following example:

<?xml version="1.0" encoding="UTF-8"?>
<manager name="DEPT" logicalName="Dept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
  <items>
    <item name="DNAME" logicalName="Dname" type="System.String" physicalName="DNAME">
        <synchronizeWith>
          <item name="COUNTRY" businessObject="DEPT" />
        </synchronizeWith>
    </item>
    <item name="COUNTRY" logicalName="Country" type="System.String" physicalName="COUNTRY"   />
</manager>

 

CopyValueFrom property

  1. The CopyValueFrom property, specifies the source of the item which be used to populate the item value.
  2. There can be multiple items with the property copyValueFrom assigned.
  3. Property initialization:
    - In the creation of a new row
    - In the initialization of a SimpleBusinessObject 
    - After query event of each loaded row
    - After the execution and load of the DataSet with its results

In the *.Manager.Config,xml the CopyValueFrom can be configured as the following example:

<?xml version="1.0" encoding="UTF-8"?>
<manager name="EMP" logicalName="Dept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
  <items>
    <item name="DNAME" logicalName="Dname" type="System.String" physicalName="DNAME">
      <copyValueFrom>
        <item name="COUNTRY" businessObject="DEPT" />
      </copyValueFrom>    
    </item>
    <item name="COUNTRY" logicalName="Country" type="System.String" physicalName="COUNTRY">
      <value>
        <constant>PORTUGAL</constant>
      </value>
    </item>
</manager>


Property priorities behaviour

In case of assigning more than one of these properties to a item, we must keep in mind the priorities.

The property synchronizedWith prevails over the CopyValueFrom, and the CopyValueFrom prevails over ItemValue.

In the case scenario as described below, the value if the item "DNAME" would be filled with the value from the DESC.

<?xml version="1.0" encoding="UTF-8"?>
<manager name="DEPT" logicalName="Dept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <items>
    <item name="DNAME" logicalName="Dname" type="System.String" physicalName="DNAME">
      <synchronizeWith>
        <item name="DESC" businessObject="DEPT" />
      </synchronizeWith>
      <copyValueFrom>
        <item name="COUNTRY" businessObject="DEPT" />
      </copyValueFrom>    
	  <value>
        <constant>VISEU</constant>
      </value>
    </item>
    <item name="COUNTRY" logicalName="Country" type="System.String" physicalName="COUNTRY">
      <value>
        <constant>PORTUGAL</constant>
      </value>
    </item>
    <item name="DESC" logicalName="Desc" type="System.String" physicalName="DESCRIPTION">
      <value>
        <constant>VISEU</constant>
      </value>
    </item>
  </items>
</manager>