cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
KevinHamer
Level: Power Up

Time tracker on status, stored in database

Hi fellow PowerAppers,

 

We are creating a PowerApp for our workshop (conversion of light commercial vehicles) that tracks the status of all vehicles from the moment the car arrives to the moment the car leaves.

 

For this app we use an on-premise database which stores all vehicle data (make, model, chassisnr, etc.), different vehicles statussen (e.g. WIATING_FOR_PRODUCTION, IN_PRODUCTION, RMA, READY_FOR_PICKUP, etc.) and more. 

 

When a vehicle goes into production, engineers can open the assigned order and start the vehicle conversion. We would like to track the time that engineers spend on a conversion with a start / stop button (see screenshot below). This total time should be added at correct vehicle (unique value is CHASSIS_NR) and its status (in this example IN_PRODUCTION) in our database table (dbo.VEHICLE_STATUS_TIMES).

 

I've managed to create a simple timer (screenshot below), but the total amount of time is stored nowhere. Although it would be cool, it doesn't necessarily need to show the total amount of time in the button.

 

Do you know how we can program this?

2019-06-05 14_17_22-Window.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Time tracker on status, stored in database

Hi @KevinHamer ,

Could you please share a bit more about your scenario?

Do you want to start recording the time when you click the Timer control (Start), and then save the total time into SQL table when you click the Timer control again (Stop)?

Which formula do you use within your app? Could you please share a bit more about it?

Further, how to you list your all available vehicles in your app? Using Gallery? Do you display detail info of a specific selected in your Gallery within the "Productie-InProduction-Detail" screen?

 

I assume that you use a Gallery control to list all available vehicles, and display detail info of a specific selected in your Gallery within the "Productie-InProduction-Detail" screen, is it true?

 

Based on the needs that you mentioned, I think the Patch function could achieve your needs. I have made a test on my side, please take a try with the following workaround:5.JPG

 

4.JPG

 

4.JPG

Set the OnVisible property of the screen to following:

Set(IsStart, false)

On your side, please set the OnVisible property of the "Productie-InProduction-Detail" screen to following:

Set(IsStart, false)

 

Set the Duration property of the Timer control (Timer1) to following:

60000 * 60

Set the Start property of the Timer control (Timer1) to following:

IsStart

 

Set the OnSelect property of the "Start/Pause" button to following:

Set(IsStart,!IsStart);
If(
IsStart = false,
Collect(TimeCollection, Round(Timer1.Value/1000,0));Reset(Timer1)
)

On your side, you should type following:

Set(IsStart,!IsStart);
If(
IsStart = false,
Patch(
'dbo.VEHICLE_STATUS_TIMES',
Defaults('dbo.VEHICLE_STATUS_TIMES'),
{
ChassisnummerColumn: Gallery1.Selected.Chassisnummer, /* <-- Gallery1 represents the Gallery control in your app to list all your available vehicles */
TimeColumn: Round(Timer1.Value/1000,0),
StatusColumn: "IN_PRODUCTION"
}
);Reset(Timer1)
)

Note: I assume that detail info of a vehicle in your "Productie-InProduction-Detail" screen is based on the selected item in your Gallery (Gallery1, list all your available vehicles).

 

I have made a test on my side, please check the following GIF screenshot:Test.gif

 

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Time tracker on status, stored in database

I have one that tracks time.

 

Mine stores the data in a sharepoint list and when they click a certain button it stores their start time and a certain button stores the stop time and I use a calculated field in the SharePoint list to find the difference between the two and give me the time.

 

When the user logs in the system looks to see if they are already clocked in and if so their only choice is to clock out. If they are not already clocked in on a job their only option is to clock in. Simple but works well. 

 

I like the calculated time best because it gets adjust if they somebody forgot to clockout and it has to be corrected...stuff like that.

KevinHamer
Level: Power Up

Re: Time tracker on status, stored in database

Hi Rebecca,

 

Do you perhaps have a topic on this app?

Community Support Team
Community Support Team

Re: Time tracker on status, stored in database

Hi @KevinHamer ,

Could you please share a bit more about your scenario?

Do you want to start recording the time when you click the Timer control (Start), and then save the total time into SQL table when you click the Timer control again (Stop)?

Which formula do you use within your app? Could you please share a bit more about it?

Further, how to you list your all available vehicles in your app? Using Gallery? Do you display detail info of a specific selected in your Gallery within the "Productie-InProduction-Detail" screen?

 

I assume that you use a Gallery control to list all available vehicles, and display detail info of a specific selected in your Gallery within the "Productie-InProduction-Detail" screen, is it true?

 

Based on the needs that you mentioned, I think the Patch function could achieve your needs. I have made a test on my side, please take a try with the following workaround:5.JPG

 

4.JPG

 

4.JPG

Set the OnVisible property of the screen to following:

Set(IsStart, false)

On your side, please set the OnVisible property of the "Productie-InProduction-Detail" screen to following:

Set(IsStart, false)

 

Set the Duration property of the Timer control (Timer1) to following:

60000 * 60

Set the Start property of the Timer control (Timer1) to following:

IsStart

 

Set the OnSelect property of the "Start/Pause" button to following:

Set(IsStart,!IsStart);
If(
IsStart = false,
Collect(TimeCollection, Round(Timer1.Value/1000,0));Reset(Timer1)
)

On your side, you should type following:

Set(IsStart,!IsStart);
If(
IsStart = false,
Patch(
'dbo.VEHICLE_STATUS_TIMES',
Defaults('dbo.VEHICLE_STATUS_TIMES'),
{
ChassisnummerColumn: Gallery1.Selected.Chassisnummer, /* <-- Gallery1 represents the Gallery control in your app to list all your available vehicles */
TimeColumn: Round(Timer1.Value/1000,0),
StatusColumn: "IN_PRODUCTION"
}
);Reset(Timer1)
)

Note: I assume that detail info of a vehicle in your "Productie-InProduction-Detail" screen is based on the selected item in your Gallery (Gallery1, list all your available vehicles).

 

I have made a test on my side, please check the following GIF screenshot:Test.gif

 

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: Time tracker on status, stored in database

@KevinHamer 

 

I work for a company that fabricates commercial AC units and this app is used by our Engineering department. They were wanting to track how much time they spend working on each job so they use this to clock in and out of various jobs throughout the day and we have several reports that are ran off this data so they can look at a job and see the total hours. It helps them notice if too much time is being spent on a job to figure out the issue but also to have a better idea of how much time is spent on certain unit types. 

 

Does that answer your question?

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 41 members 4,967 guests
Please welcome our newest community members: