Append MDMap(AMDMap)

Quick Guide >>

An MD Map can be defined in a free text format. Set the Extended property of MDMap to True and click on the Map Text property to define an MD Map as a free form text.

Consider the scenario with Loan Application Tstruct and Repayment Tstruct.The Loan Application Tstruct contains a field named RepaidAmount. The Repayment Tstruct captures repayment data .It is here that the user enters amount that is being repaid. Now, this repaid amount from the Repayment Tstruct has to be updated to the Loan Application Tstruct. When changes are made to a repayment transaction, the corresponding changes are to be done to the RepaidAmount field in the Loan Application structure. Again, if the corresponding record does not exist in the Loan Application Tstruct, it is added based on the values in the Repayment Tstruct.

In this text, you can define an MD Map as below

transid = repay

mastertransid = loanapp




Tag Description
transid The transid tag is the name of the detail tstruct. This tag is optional.
mastertransid The mastertransid tag specifies the name of the master tstruct that has to be updated.

The first character is a command to Axpert.

@ means that the value in ApplicationNo is searched in the ApplicationNo column in the master table. If the record is found, the PaidAmount is added to the RepaidAmount in the master.

If the record is not found then a new record is added in the master only if Append=true.

In case a field from a grid DC is a detail field, then its frame no is specified in the sourceframe tag as SourceFrame = 2.
ControlField Set the control field name here. Set InitOnDel to True. This is equivalent to using Initialize on delete property in MDMap.
TableName Instead of updating a field in a Tstruct, you could update field in a table that is not part of any tstruct. you can do this by setting the TableName tag instead of using the MasterTransid tag. In this case, you can specify the max decimals to which the field value should be rounded off in the map tag itself as below
The above map means, add PaidAmount to RepaidAmount and round it off to 2 decimals. This may be required for maintaining precision. This is applicable only if the master field is numeric. Instead of hard coding the decimal as 2, you can use the application variable _currdecimal. This variable consists of the maximum decimal as defined in the application properties. You can do this by defining the tag as below
+RepaidAmount, _currdecimal=PaidAmount

Note : Just the same way as with +, you can use   for less type of update, * for replace, for increment, ! for decrement, > for highest, < for lowest as the first character in a map string.

The concept of AMDMap is useful to create summary tables that store data like daily sales, monthly receipts etc. These summary tables can be updated with such maps from the transaction tables.