Adding new field in datamapper with calculation

Hi - is there any documentation to help with adding a new field with a calculation in the data mapper. I can’t seem to get the syntax right. All I am trying to to is create a new field that takes a field minus another field. I know how to add a new field, I just cant seem to get any of the syntax right.

Thanks

This is the code I used to increment

/**********************************************************
/ Add the tax amount to the same tax code amount in the
/ table
*********************************************************/
var currentTaxCode = data.extract(‘./TaxCode’);

for(let i in record.tables.taxTrans){
    if(record.tables.taxTrans[i].fields.TaxCode === currentTaxCode){
	    record.tables.taxTrans[i].fields.TaxAmount += parseFloat(data.extract('./TaxAmount')*-1);
    }
}

Here is another example from within a detail table:

/***********************************************************************************
/ Strip the amount from format to make it standard
**********************************************************************************/

function ConvertToAmount(amount){
var convertedAmount;

convertedAmount = amount.replace(record.fields.ThousandSeparator,'');
convertedAmount = convertedAmount.replace(record.fields.DecimalSeparator,'.');

return(convertedAmount);
}

if(record.tables.customer.length === 1){
    var theRecord = record.tables.customer[0].tables.BusinessTypeDetail;
    var tableLength = theRecord.length;
    theRecord[tableLength-1].fields.totalListPrice += parseFloat(ConvertToAmount(theRecord[tableLength-1].tables.detailLines[steps.currentLoopCounter-1].fields.Line_Amount_List_Price));
    theRecord[tableLength-1].fields.totalResellerPrice += parseFloat(ConvertToAmount(theRecord[tableLength-1].tables.detailLines[steps.currentLoopCounter-1].fields.Line_Amount));
}

Thank you for your examples. I am still trying to figure this out.