resetData will reset all the form fields.
To reset data for a few fields in the form, you can create an array of fields and then pass that array to a function and set data to null for each field by traversing the array.
This will help you write less code.
Please follow this :
https://docs.mktossl.com/docs/experience-manager-65/forms/getting-started/create-first-interactive-communication/create-form-data-model0.html
You can write like below:
var total =0;
var oFields = xfa.resolveNodes("tblHandlingUnits.rowHUDataTBL[*]");
for (var i = 0; i < oFields.length; i++){
var rowInstance = oFields.item(i);
// Now with rowInstance you can access any fields inside this
total += parseInt(rowInstance.(path to your fiel...
Follow the below link:
https://experienceleaguecommunities.adobe.com/t5/adobe-livecycle-questions/get-current-date/m-p/117777#:~:text=write%20the%20script..-,Num2Date(Date()%2C%20%22MM%2FDD%2FYYYY%22,and%20search%20for%20Num2Date%20function.