cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OlaH
Resolver I
Resolver I

Timesheet - multiple names at the same time

I want to make a timesheet where the date and time attributed to several people at once.
Date and time are two text boxes with Today and Now "hh:mm".
I tried to select multiple names from a list box but got "false" as name. The data source is an Excel file on my OneDrive.
Could it be done? How?

5 REPLIES 5
mr-dang
Community Champion
Community Champion

 If I understand your need, you are trying to assign multiple people to the same time block on a timesheet.

 

You will need to nest one gallery into another gallery.

 

In the example below, my outer gallery is just ["Team 1","Team 2","Team 3",...]. My inner gallery uses a formula that Filters which names are associated with which team.

 

2016-10-25.png

 

 So you might have your outer gallery, Gallery1, be the dates and times needed for your timecard. Your nested gallery, Gallery2, will be created inside Gallery1. It will need a formula like below:

Filter(Gallery2,DateColumnAssociatedWithEachPerson=ThisItem.Date)

This will show names of people whose names are associated with the given datetime.

 

I can clarify more if I know what your datasource looks like.

 

Microsoft Employee
@8bitclassroom

Thank you so much mr-dang for your advice but it's not really what I had in mind. I'm trying to make an timesheet app for an after school center and I want to report when every kid goes home. And they don't go home at the same time every day. Not like your great idea of teams. 
I'd like to be able to pick several kids, like in a list box, and assign them at the same time.
Something like this.

 

timesheetapp.png

  

mr-dang
Community Champion
Community Champion

Got it. I would recommend using Gallery1 with those names rather than a ListBox. This will allow you to reference each entry with:

Last(FirstN(pupils,#)).Name

Gallery1 will not fit inside the Form, so this solution would work independent of one. So rather than using SubmitForm, you could setup a Timer control that Patches for the number of items selected the Gallery1. This method will need to manually reference each argument in the Form, but it will Patch automatically. See @hpkeong's post for more information.

checkicon.OnSelect:
UpdateContext({savenames: true, iter: 0})
Timer1.Text: iter
Timer1.AutoPause: false
Timer1.AutoStart: savenames
Timer1.Repeat: savenames
Timer1.Start: savenames
Timer1.OnTimerEnd:
If(savenames,
If(iter<CountRows(Gallery1.AllItems),
UpdateContext({iter: iter+1});

Patch(goinghome,Defaults(goinghome),
{Date: TextInput1.Text,
Time: TextInput2.Text,
Pupil: Last(First(pupils,iter)).Name
}
),

UpdateContext({savenames: false});
NewForm(Form1)
)
)

 

This formula will Patch until the iteration number, iter, is equal to the number of items selected in your Gallery of names. It will count up one each time. At its conclusion, it will stop the timer and clear the form.

Microsoft Employee
@8bitclassroom

Thank you ever so much mr-dang for your edwise and effort to help.

The thing is, I'm just a curios guy who just started looking at Powerapps and read the tutorials. Therefore I'm not really sure what you mean. I'll never used Patch but I'll try my best.

Perhaps I'll be back or perhaps you could help me with a more detailed instruktion. 

Hi again

I believe this is just what we're looking for but I'm a beginner at Powerapps and need a more detailed instruction. 

Could someone help me?

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,703)