There should be 3 records under each date? But instead most of them are listed under the 23rd. I am guessing the error is somewhere in the red highlighted areas. My code is below:
//initialise collection
allRows = Collection();
for each dateSelected in input.Holiday_Clinic_Dates_Available
{
if(How_many_participants_would_you_like_to_book_in == 1)
{
// declaring the row
Row1 = Book_a_Holiday_Clinic.Holiday_Clinic_Daily_Bookings_Subform();
// assigning values for various subform fields in the row
Row1.Name=input.Name_child_1;
Row1.DOB=input.DOB_child_1;
Row1.Age=zoho.currentdate.getYear() - input.DOB_child_1.getYear();
Row1.Waiver="No";
Row1.Day=dateSelected;
Row1.Email=input.Email_child_1;
Row1.Phone_Number=input.Phone_Number_child_1;
Row1.Payment_Status="Success";
allRows.insert(Row1);
}
if(How_many_participants_would_you_like_to_book_in == 2)
{
// declaring the row
Row1 = Book_a_Holiday_Clinic.Holiday_Clinic_Daily_Bookings_Subform();
// assigning values for various subform fields in the row
Row1.Name=input.Name_child_1;
Row1.DOB=input.DOB_child_1;
Row1.Age=zoho.currentdate.getYear() - input.DOB_child_1.getYear();
Row1.Waiver="No";
Row1.Day=dateSelected;
Row1.Email=input.Email_child_1;
Row1.Phone_Number=input.Phone_Number_child_1;
Row1.Payment_Status="Success";
// declaring the row
Row2 = Book_a_Holiday_Clinic.Holiday_Clinic_Daily_Bookings_Subform();
// assigning values for various subform fields in the row
Row2.Name=input.Name_child_2;
Row2.DOB=input.DOB_child_2;
Row2.Age=zoho.currentdate.getYear() - input.DOB_child_2.getYear();
Row2.Waiver="No";
Row2.Day=dateSelected;
Row2.Email=input.Email_child_2;
Row2.Phone_Number=input.Phone_Number_child_2;
Row2.Payment_Status="Success";
allRows.insert(Row1,Row2);
}
if(How_many_participants_would_you_like_to_book_in == 3)
{
// declaring the row
Row1 = Book_a_Holiday_Clinic.Holiday_Clinic_Daily_Bookings_Subform();
// assigning values for various subform fields in the row
Row1.Name=input.Name_child_1;
Row1.DOB=input.DOB_child_1;
Row1.Age=zoho.currentdate.getYear() - input.DOB_child_1.getYear();
Row1.Waiver="No";
Row1.Day=dateSelected;
Row1.Email=input.Email_child_1;
Row1.Phone_Number=input.Phone_Number_child_1;
Row1.Payment_Status="Success";
// declaring the row
Row2 = Book_a_Holiday_Clinic.Holiday_Clinic_Daily_Bookings_Subform();
// assigning values for various subform fields in the row
Row2.Name=input.Name_child_2;
Row2.DOB=input.DOB_child_2;
Row2.Age=zoho.currentdate.getYear() - input.DOB_child_2.getYear();
Row2.Waiver="No";
Row2.Day=dateSelected;
Row2.Email=input.Email_child_2;
Row2.Phone_Number=input.Phone_Number_child_2;
Row2.Payment_Status="Success";
// declaring the row
Row3 = Book_a_Holiday_Clinic.Holiday_Clinic_Daily_Bookings_Subform();
// assigning values for various subform fields in the row
Row3.Name=input.Name_child_3;
Row3.DOB=input.DOB_child_3;
Row3.Age=zoho.currentdate.getYear() - input.DOB_child_3.getYear();
Row3.Waiver="No";
Row3.Day=dateSelected;
Row3.Email=input.Email_child_3;
Row3.Phone_Number=input.Phone_Number_child_3;
Row3.Payment_Status="Success";
allRows.insert(Row1,Row2,Row3);
}