Posting child transactions
Transaction Generator Maps (GenMaps) are used to post data(child transactions) from one transaction form to another transaction form.
- The Tstruct from which data is posted is called the source Tstruct. The Tstruct into which data is posted is called the target Tstruct. When data is saved in the source Tstruct, the Genmap posts child transactions into the target Tstruct. The fields in the target tstruct are mapped to fields in the source Tstruct.
- At run time when data is submitted to the source Tstruct, this data is automatically passed to the target Tstruct as defined in the map.
- The target Tstruct validates and saves into database. This is done as a single database transaction.
Rules and maps in the target
- When data is posted into a target Tstruct, all the validation expressions defined for the fields in the target tstruct are evaluated. If there are any failures, an exception is raised and the transaction is rolled back i.e. both the source and target transactions are not saved into database.
- The SQL related to every Accept field in the target are fired and the result is set as the value of the field.
- The expressions related to all Accept and Calculate fields are evaluated and the result is set as the value of the field.
- Auto generation of numbers into auto generated fields are done based on the rule set in the target.
Fill fields are set based on the value set to Select fields.
- If a value is mapped to a Select field, the value is verified against the SQL result. If not found in SQL result, an exception is raised. All Fill fields attached to a Select field are also set with corresponding values.
- In some cases, no value will be mapped to a Select field. But the SQL result may contain only one row. The value from this row is considered as the selected value if the Auto fill property is set to true in this field.
- Any MDMaps defined in the target Tstruct are also executed.
- Any GenMap associated with the target Tstruct are also executed.
If transactions need to be posted only on satisfying a pre-condition, then use the Control Field property. Select a field from the current tstruct as a control field. This field should contain T or F. The Genmap will be applied only if this field contains T. You can use an expression with IIF function to implement a rule.A control field cannot have its Save Value property set to false.
You can also set the Genmap to be made active only if the transaction is approved or rejected. This is applicable only if there is a work flow attached with the Tstruct. Set these property values to “Yes” or “No” depending on need.