You have created a template with an 'if-clause' which determines the exact conditions under which the code in the 'then-part' is executed.
Example for CentralAccount:
If CStr($ImportSource$) <> "ADS" And _
String.Compare(CStr($ImportSource$), "MYIMPORTSOURCE", True) <> 0 And _
(Not CBool(Connection.Variables.Get("FULLSYNC")) Or CStr($ImportSource$).StartsWith("EBS"))
Then………………$FirstName$ …. $LastName$ …..
But the code of the 'then-part' loops and is executed several times, which is undesirable.
Whenever a property, which is used in $-notation in the template, changes its value, the template code is invoked. Other properties are likely not to be set.
As a result the 'if-part' evaluates differently than intended and the 'then-part' is executed several times, which can pose a performance problem.
You could put a wrapper around your code in order to prevent it from executing if not all properties are set. i.e.:
If $FirstName$ <> "" and $LastName$ <> "" Then
... old template
The sequence of the assignment of values to the bag has no influence on the sequence of assignment of the values to iSingleDBObject.
There is a way to influence the sequence of assignment of the values to iSingleDBObject:
There is the table DialogColumnBulkDependencies for this purpose. In this table you can define predecessor-successor relationships of single columns.
In the case above the column "ImportSource" could be defined as predecessor of “LastName” and a similar definition for “FirstName”.
You can work on this table only with ObjectBrowser. As this is a very seldom used function, it is not available in Designer.