I hope the following topic hasn't been covered elsewhere... I looked for a while without success.
I have a quick question concerning increasing the efficiency of the use of subforms within one of my apps in a management capacity.
As an example, I have a form with a subform that tracks work order issues. Each row added represents a work order issue that must be accompanied with corrective action to demonstrate that the problem has been resolved. The overall status of the work order is governed by a single line field named status. The 'status' represents complete when all identified defects have been fixed.
I am currently using the following setup:
subform "Work_Order_Details"
Defect_Description - On user input:
Total_Defects=0;
for each row in Work_Order_Details
{
if(input.Total_Defects != null)
{
Total_Defects=(input.Total_Defects + 1);
}
if(row.Defect_Description == null)
{
Total_Defects=(input.Total_Defects - 1);
}
}
if(input.Total_Defects == input.Total_Completed)
{
Repairs_Complete="Yes";
}
else
{
Repairs_Complete="No";
}
The same code is used for Total_Completed with respect to each row that is added.
subform: Work_Order_Details
Corrective_Action_Taken: On user input:
input.Total_Completed = 0;
for each row in Work_Order_Details
{
if (input.Total_Completed != null)
{
input.Total_Completed = (input.Total_Completed + 1);
row.Date_of_corrective_action = zoho.currentdate;
}
if (row.Corrective_Action_Taken == null)
{
input.Total_Completed = (input.Total_Completed - 1);
row.Date_of_corrective_action = null;
}
}
if (input.Total_Defects == input.Total_Completed)
{
input.Repairs_Complete = "Yes";
}
else
{
input.Repairs_Complete = "No";
}
The form simply counts the number of defects and number of corrections and when the two number fields are equal the form changes the status to completed... is there a more efficient way to complete this endeavor?
I hope I provided enough details to clarify my question.