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 Platform Community / Forums / Power Apps / Editable table with ti...
Power Apps
Answered

Editable table with time functions

(0) ShareShare
ReportReport
Posted on by

Hi

I want to make an editable table that logs the time in and time out of an activity

 

My Sharepoint list has the following fields

Date: Datefield

Name: Lookup to another Sharepoint list

TimeIn: date/Time

TimeOut: Date/Time

TotalTime: Calculated to give me the difference in minutes - (TimeOut-TimeIn)*1440)

 

I was thinking if i could get the Date field to automatically populate the date section of the two time fields but im not sure how to do it in a Power apps gallery rather than form and how to add the time in

Categories:
  • Silvester. Akakpo Profile Picture
    783 on at

    I can't get your question straight forward, can you take a snapshot to illustrate it?

  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @TANC ,

    Do you want to auto populate TimeIn column when edit this record and auto populate TimeOut column when end of editing(and save it)?

    If yes, I would suggest you use Text column to keep the time. I did a simple test on my side for reference:

    1. This is my list called “TimeList” with three Text columns called “TimeIn”, “TimeOut” and “TotalTime”:

    v-albai-msft_0-1615973633491.png

    This is my gallery(I add a label to keep ThisItem.TotalTime):

    v-albai-msft_1-1615973633495.png

    2. With the default app template, when click the arrow button next each record, it will go to the DetailedScreen. So go to the DetailedScreen, add “Set(VarTimeIn,Now())” function into the OnSelect property of the pencil/edit button, so that when you edit an item, it will save current time into this variable.

    v-albai-msft_2-1615973633499.png

    3. Go to edit screen, set the TimeIn control to the variable just created:

    v-albai-msft_3-1615973633501.png

    4. This time, we should keep the current time into TimeOut column when submitting changes, so set OnSelect property of save button to below(use title to lookup this record, and change its TimeOut column to Now(), also calculate time difference and keep the value into its TotalTime column):

     

    SubmitForm(EditForm1);Patch(TimeList,LookUp(TimeList,Title=DataCardValue5.Text),{TimeOut:Now(),TotalTime:DateDiff(DateTimeValue(DataCardValue6.Text),Now(),Seconds)})

     

    For test purpose, I use Seconds inside DateDiff(). On your side, the code should be:

    SubmitForm(EditForm1);Patch(TimeList,LookUp(TimeList,Title=DataCardValue5.Text),{TimeOut:Now(),TotalTime:DateDiff(DateTimeValue(DataCardValue6.Text),Now(),Minutes)})

    v-albai-msft_4-1615973633505.png

    This time, when you edit a record, it will auto populate with the edit time and when you save your changes, it will auto populate the exit time.

    v-albai-msft_5-1615973633507.png

    Best Regards,

    Allen

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard