Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

submitting 2 forms if total hours = over 8


I am having a ticket system where workers can clock-in during their worktime. The app looks like this:

Database looks like this:
Whenever the column tijdtotaal of the day they are wanting to fill in a ticket, is higher than 8, I want it to make a new ticket with the rest of the hours. 

This is what we need to do: 

-Everytime a new ticket gets created, we need to filter the database on the date of today and see how many rows are there. It then needs to check if TijdTotaal is over 8. When it is over 8, I want it to match up exactly to 8. This may be confusing so I will explain it with a screenshot.

How it is now:
How it should look like:

It needs to calculate it to 8 and use the rest of the time to make a new ticket with the same information as the last ticket. How can we get this?

Just using this code to send the form away: SubmitForm(EditForm1)

I hope I have explained this well enough, if I didn't, let me know and I will try and explain it better. 

Code we have tried right now: 



ClearCollect(colUrenRegistratie, Filter(
        Datum = Text(
            Today (),
        ) And varcurrentuser = Werknemer

        sumTijdTotaal: Sum(colUrenRegistratie,TijdTotaal)
            remainder: 8-Mod(sumTijdTotaal,8)
                Notify("One or more fields in the form were not entered correctly.",NotificationType.Error),
                Patch(UrenRegistratie,Defaults(UrenRegistratie),EditForm1.Updates,{TijdTotaal: remainder});
                Patch(UrenRegistratie,Defaults(UrenRegistratie),EditForm1.Updates,{TijdTotaal: EditForm1.Updates.TijdTotaal-remainder});


                    Notify("There was an error submitting the form and records may not have been submitted successfully.",NotificationType.Error);


Super User
Super User

So when a record is entered you want to submit another form? That is a lot of code for a low code app. I would offload the process go power automate and on create or update of the first record, have flow evaluate the dat submitted and if less than 8 hours roll it up to 8

Hello @jlindstrom,

Thank you for your answer. The app needs to do way more than that. 

If a ticket gets created thats over 8 hours, it needs to split it up. Let's say I make a ticket of 9 hours, it should split them up. 

The first one would have 8 hours, second ticket would have 1 hour. 

And then another one gets created with 8 hours, it will needs to get split again, first one has to be 7 hours (1 from the last ticket + 7 to make it 😎 

Second ticket then gets 1 hour, the remainder. It would be helpfull to read all of the explanations above. 

So you have two general options: client side (build it into the app) or server side (use power automate)


you can make your solution do way more than what you describe, my advice is be strategic about how you do it so you provide a performance experience.



If you are querying the database and splitting things up you probably want to move to patch rather then submit form.

the reason I recommend patch vs submit form is because it allows you a lot more control, where submit simply saves the record.


see mr Dangs video for more details


and if you need bulk data operations such as splitting up existing records, that should typically be done as a background process


How would you do the full code then? @jlindstrom 

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (89,113)