// First, check if the item to be patched is not blank
If(
Not(IsBlank(CurrentDSDRecord)),
// Proceed with Patch if an item was found
Patch(
Daily_Site_Diary,
CurrentDSDRecord,
{
Project: DSD_Text_Project.Text,
'Project Number': DSD_text_Project_Number.Text,
'Protranz PM Email': 'DSD_Text_Project_Manager(Email)'.Text,
'Protranz Coordinator Email': 'DSD_Text_Project_Coordinator(Email)'.Text,
Client: DSD_Text_Client.Text,
Weather: DSD_Text_Weather.Text,
Date: DSD_Date_Selector_Date.SelectedDate,
'Site Supervisor': DSD_Input_Site_Foreman.Text,
'Work Performed': DSD_Input_Work_Performed.Text,
'Variations / Site Instructions': DSD_Input_Variations.Text,
Delays: DSD_Input_Delays.Text,
Considerations: DSD_Input_Considerations.Text,
Materials: DSD_Input_Materials.Text,
'Supervisor Comments': DSD_Input_Supervisor_Comments.Text,
Status: "Submitted",
'Completed By': DSD_Input_Completed_by.Text
}
)
);
// First, check if the item to be patched is not blank
If(
Not(IsBlank(CurrentDSDRecord)),
With(
{
photoRecord: LookUp(
Form_Images,
Title = CurrentDSDRecord.Title
)
},
If(
Not(IsBlank(photoRecord)),
Patch(
Form_Images,
photoRecord,
{
Photo1: If(
IsBlank(photoRecord.Photo1),
DSD_Taken_Image_Photo1.Image,
photoRecord.Photo1
),
Photo2: If(
IsBlank(photoRecord.Photo2),
DSD_Taken_Image_Photo2.Image,
photoRecord.Photo2
),
Photo3: If(
IsBlank(photoRecord.Photo3),
DSD_Taken_Image_Photo3.Image,
photoRecord.Photo3
),
Photo4: If(
IsBlank(photoRecord.Photo4),
DSD_Taken_Image_Photo4.Image,
photoRecord.Photo4
),
Photo5: If(
IsBlank(photoRecord.Photo5),
DSD_Taken_Image_Photo5.Image,
photoRecord.Photo5
),
Photo6: If(
IsBlank(photoRecord.Photo6),
DSD_Taken_Image_Photo6.Image,
photoRecord.Photo6
),
Photo7: If(
IsBlank(photoRecord.Photo7),
DSD_Taken_Image_Photo7.Image,
photoRecord.Photo7
),
Photo8: If(
IsBlank(photoRecord.Photo8),
DSD_Taken_Image_Photo8.Image,
photoRecord.Photo8
)
}
)
)
)
);
//Reset the feilds
Reset(DSD_Date_Selector_Date);
Reset(DSD_Input_Site_Foreman);
Reset(DSD_Input_Work_Performed);
Reset(DSD_Input_Variations);
Reset(DSD_Input_Delays);
Reset(DSD_Input_Considerations);
Reset(DSD_Input_Materials);
Reset(DSD_Input_Supervisor_Comments);
Reset(DSD_Input_Completed_by);
Reset(DSD_PenInput_Signature);
Reset(DSD_AddMediaButton_1);
Reset(DSD_AddMediaButton_2);
Reset(DSD_AddMediaButton_3);
Reset(DSD_AddMediaButton_4);
Reset(DSD_AddMediaButton_5);
Reset(DSD_AddMediaButton_6);
Reset(DSD_AddMediaButton_7);
Reset(DSD_AddMediaButton_8);
//Navigate
Navigate(Daily_Site_Diaries_Screen)