web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

OnTimerEnd - error

(0) ShareShare
ReportReport
Posted on by 16

Morning all, 

Hope everyone is well and in good health.

So I've set some code on the OnTimerEnd that it checks if online or offline and then sends and email for submission, but I am getting an error and not getting why, it maybe simple but for me it's frustrating me.

Any help would be appreciated.

 

KevDaRed_0-1632809887962.png

 

If(Connection.Connected,
If(CountRows(SubmissionFormCol)<>0,
ClearCollect(SubmissionFormCol, SubmissionFormCol);
ForAll(
SubmissionFormCol,
Collect(
'End of Shift New Report',
First(SubmissionFormCol);
Remove(SubmissionFormCol,First(SubmissionFormColCount));
Mail.SendEmailV3(DataCardValue4.Text, "End of Shift Report", "<Table width='100%' Align='center' style='border-collapse: collapse'>
<tr>
<td style='align: left; width: 45px;'><img src='https://i.ibb.co/kGxmCXm/DF-Logo-Black.png' width='59' height='45' /></td>
<td style='font-weight: bold; font-size: 28px; font-style: normal; line-height: 34px; text-align: center; align: center; vertical-align: bottom;'>New End of Shift Report</td>
</tr>
</Table>
<div style='width:100%;align:center;background-color:#f3f3f3;'>
<hr style='background-color: #742774; color: #742774; height: 3px; width: 100%; vertical-align:top;' />
<p style='position: absolute; font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; color: #000000;'>Your End of Shift report has been submitted succesfully.</p>
<br /><br />
<br>
<br>
<Table style='border-collapse: collapse;' border='1' width='45%' rules='all' cellpadding='3' Align='center' bgcolor='#f3f3f3'>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Shift Type</td>
<td style='font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DataCardValue14.Text&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Shift start date</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DatePicker1_2.SelectedDate&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Team leader on shift</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DataCardValue16.Text&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Location</td>
<td style='font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DataCardValue17.Text&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Planned start date</td>
<td style='font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DateValue1.SelectedDate&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Planned start time</td>
<td style='font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&HourValue1.Selected.Value&":"&MinuteValue1.Selected.Value&"</td>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Actual start date</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DateValue9.SelectedDate&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Actual start time</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&HourValue9.Selected.Value&":"&MinuteValue9.Selected.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Planned end date</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DateValue6.SelectedDate&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Planned end time</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&HourValue6.Selected.Value&":"&MinuteValue6.Selected.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Actual end date</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DateValue7.SelectedDate&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Actual end time</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&HourValue7.Selected.Value&":"&MinuteValue7.Selected.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Planned work</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DataCardValue20.Text&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Was the work completed?</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&Toggle1.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Have you completed WAIFS?</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&Toggle1_1.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Time on tools (Duration in hours and minutes)</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&TimeOnToolsHour.Selected.Value&":"&TimeOnToolsMins.Selected.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Non-Time on tools (Duration in hours and minutes)</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&NonTimeOnToolsHour.Selected.Value&":"&NonTimeOnToolsMins.Selected.Value&"</td>
</tr>
<tr>
<td style='text-align: left; font-style: normal; font-weight: bold; font-size: 20px; line-height: 24px; padding-right: 10px;' width='40%'>Comments</td>
<td style=' font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; padding-left: 10px;'>"&DataCardValue29.Text&"</td>
</tr>
</Table>
<br />
<br /><br />
</div>
<div style='background-color:#742774;text-align:center;font-style:normal;font-weight:bold;font-size:18px;line-height:22px;color:'><br />This App was created by the Digital Factory. Visit us at <a href='https://nrdigital.co' style='color:;'>https://nrdigital.co/</a> to find out more about what we do.<br /><br />
</div>", true);
//SubmitForm(Form2);
ResetForm(Form2);
Notify(
"Form successfully submitted",
Success
)

 

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    Consider modifying your code to:

    If(Connection.Connected,
     If(CountRows(SubmissionFormCol)<>0,
     ForAll(
     SubmissionFormCol,
     Collect('End of Shift New Report', First(SubmissionFormCol));
     Remove(SubmissionFormCol,First(SubmissionFormCol);
     Mail.SendEmailV3(DataCardValue4.Text, "End of Shift Report", "<Table // and so on

    Your Remove() should refer to a record contained in the SubmissionFormCol collection, not another collection. As well, the Remove() should not be contained within the Collect(). Finally, I deleted what appears to be an unnecessary ClearCollect() statement.

     

    Hope that helps,

    Bryan

  • KevDaRed Profile Picture
    16 on at

    Thanks Bryan, great help.

    Now that's caused a domino affect on my app and now got another issue, see attached, can you help with this also?

    Screenshot 2021-09-29 at 07.44.31.png
  • BCLS776 Profile Picture
    8,994 Moderator on at

    @KevDaRed your next question is different enough from the first that we should ask you to Accept a Solution here and make a new post with specifics about the next one. BTW, it looks like your app is expecting a date with the form submission, but it's attempting to submit something else.

     

    Bryan

  • KevDaRed Profile Picture
    16 on at

    Agree, I realised this after.

    Thanks for your time.
    Is there a way to get a power app expert to check through my app to make sure I haven't missed anything major or basic steps.

  • BCLS776 Profile Picture
    8,994 Moderator on at

    Community members are happy to review small pieces of code and help you through bugs, but part of the job of a user/developer is to learn how to test what you build and diagnose problems on your own. I've found that if you are here to learn, there are great people here willing to share their knowledge.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 617

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard