cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Edgecko17
Helper I
Helper I

Build Time Stamp Start and End then Record

Hi,

 

Good day.

 

Can you help me to create a time stamp and record the Activity worked once the END TIME is clicked.

 

And, all results will be transferred to an excel made on OneDrive Business.

 

TIA

 

Regard,

Echo

4 REPLIES 4
v-albai-msft
Community Support
Community Support

Hi @Edgecko17 ,

What is your Start time? Is this time field that already set in your Excel?

Do you want to insert the current time as the time stamp and submit this activity when user click End time button?  If so, you can follow below steps(Just a simple example). If I misunderstand, please correct me.

1. Create a Excel file(used as datasource in my app) inside my OneDrive for Business with three field:

v-albai-msft_0-1611207242706.jpeg

2. Create a app with which data source is the above Excel. Also add an edit form for test.

3. Add a button and rename it as "EndTime". Set the OnSelect property of "EndTime" as below(replace your own data with the underlined positions. Here, DataCardValue1 is the name of my Activity Name field as below picture).

v-albai-msft_1-1611207242709.png

For creating a new activity, use this formula(this will set current time to EndTime field, you can also select a date manually for this field):

 

Patch(datasource,Defaults(datasource),{'Activity Name':DataCardValue1.Text,EndTime:Now()})

 

For edit an existing activity inside the Excel, use this formula(you should enter the right existing activity name inside the text input control):

 

Patch(datasource,LookUp(datasource,'Activity Name'=DataCardValue1.Text),{EndTime:Now()})

 

Best Regards,

Allen

Hi @v-albai-msft ,

 

Good day.

 

Thanks on this. This is the exact visual I'm looking for but ff-up questions:

 

1. Can I use drop-down lists on the Activity Names? Those lists are located on other file perhaps?

2. The "datasource" is the name I will put on the formula not the name of excel file?

3. What does the patch means?

 

Thanks

Hi @Edgecko17 ,

1. Do you want to replace Textbox by Drop down? If yes, you can refer to below article:

https://microsoft-bitools.blogspot.com/2018/07/powerapps-snack-replace-textbox-by-drop.html 

2. You can find your datasource in this place. So I should use "Activity" as my datasource in the formula, this is the Table name inside my Excel file.

v-albai-msft_0-1611306719080.png

3. Patch () can modify or create one or more records in a data source, or merges records outside of a data source. In your case, Patch() will create/edit the activity and also set EndTime field as Now().

For more information about Patch(), you can refer to this article:

Patch function - Power Apps | Microsoft Docs 

Best regards,

Allen

Hi @Edgecko17 ,

How are things going? Have you solved your issue?

If my solution is helpful to you, please mark my answer. This will benefit other community members who stuck with the same question.

Best regards,

Allen

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,286)