cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aishak12
Helper IV
Helper IV

prefilled in rows - Gallery

All,

 

I am building a timesheet App using a gallery and collection. 

 

I would like the App to start with 5 PreSaved rows which will all be blank besides the Project field. I need to fill in: 

 

Paid sick, Unpaid sick, Comp Time, Holiday, and Vacation (picture below) 

 

 

aishak12_0-1642165014743.png

 

 

 

aishak12_1-1642165092497.png

 

 

Any suggestions how to achieve this? Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @aishak12 :

Please try:

1\Set the APP's OnStart property to:

Collect(
  collectionTest,
  {
            EmployeeName: "",
            Project: "Paid Sick",
            Phase: "",
            Task: "",
            Comment: "",
            Total: "",
            Saturday: "",
            Sunday: "",
            Monday: "",
            Tuesday: "",
            Wednesday: "",
            Thursday: "",
            Friday: "",
            Date: Now(),
            LaborCode: "",
            rowNumber: 1,
            Company: ""}
);
ClearCollect(
  collectionTest,
  {Project: "Paid Sick"},
  {Project: "Unpaid Sick"},
  {Project: "Comp Time"},
  {Project: "Holiday"},
  {Project: "Vacation"}
)

2\Add a button into the gallery and set it's OnSelect property to:

Patch(
   collectionTest,
   Thisitem,
        {
            EmployeeName: Office365Users.MyProfile().DisplayName,
            Project: ProjectBox_8.Selected.Column2,
            Phase: Left(PhaseBox_6.Selected.Phase,3),
            Task: Left(TaskBox_6.Selected.Result,5),
            Comment: CommentInput4_4.Text,
            Total: TotalText_8.Text,
            Saturday: SatInput_8.Text,
            Sunday: SunInput_8.Text,
            Monday: MonInput_8.Text,
            Tuesday: TueInput_8.Text,
            Wednesday: WedInput_8.Text,
            Thursday: ThuInput_8.Text,
            Friday: WedInput_8.Text,
            Date: DatePicker1_18.SelectedDate,
            LaborCode: Left(LaborBox_6.Selected.LaborCode,3),
            rowNumber: CountRows(collectionTest),
            Company: LookUp(Table1, EmployeeEmail = User().Email, Company)
    }
)

Best Regards,

Bof

View solution in original post

3 REPLIES 3
AJ_Z
Super User
Super User

Yes I am assuming the gallery is using a collection in the items property.

 

So i would usually ClearCollect the 5 blank rows apart from project name onvisible of the page and reference the project name as the default for that input. If you need more specific help please provide the items property of the gallery. the items of the project name input in the gallery, the relevant column names in the collection. and the default/defaulteselecteditem of the project name input. 



Signature:


If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !
Link to the Power Platform Professionals United Kingdom User Group:

https://powerusers.microsoft.com/t5/Power-Platform-Professionals/gh-p/PowerPlatformProfessionalsUnit...

Yes I am using a collection in the items property. 

 

items property of the gallery: 

collectionTest

 

The items of the project name input is a Combo box named ProjectBox_8 with items property:

Projects

 

DefaultSelecteditem is blank for project input

 

 

This is my current submit button:

Set(Gal_DM, DisplayMode.Disabled);
Collect(
    collectionTest,
    Table(
        {
            EmployeeName: Office365Users.MyProfile().DisplayName,
            Project: ProjectBox_8.Selected.Column2,
            Phase: Left(PhaseBox_6.Selected.Phase,3),
            Task: Left(TaskBox_6.Selected.Result,5),
            Comment: CommentInput4_4.Text,
            Total: TotalText_8.Text,
            Saturday: SatInput_8.Text,
            Sunday: SunInput_8.Text,
            Monday: MonInput_8.Text,
            Tuesday: TueInput_8.Text,
            Wednesday: WedInput_8.Text,
            Thursday: ThuInput_8.Text,
            Friday: WedInput_8.Text,
            Date: DatePicker1_18.SelectedDate,
            LaborCode: Left(LaborBox_6.Selected.LaborCode,3),
            rowNumber: CountRows(collectionTest),
            Company: LookUp(Table1, EmployeeEmail = User().Email, Company)
        }
    )
);
Set(Exp_DM, DisplayMode.Edit);

 

 

And my current Clear button code:

 

Clear(collectionTest); Set(varComment,0); Clear(colComment); Clear(colWeek); 

 

Thank you for your help!

 

 

 

 

 

Hi @aishak12 :

Please try:

1\Set the APP's OnStart property to:

Collect(
  collectionTest,
  {
            EmployeeName: "",
            Project: "Paid Sick",
            Phase: "",
            Task: "",
            Comment: "",
            Total: "",
            Saturday: "",
            Sunday: "",
            Monday: "",
            Tuesday: "",
            Wednesday: "",
            Thursday: "",
            Friday: "",
            Date: Now(),
            LaborCode: "",
            rowNumber: 1,
            Company: ""}
);
ClearCollect(
  collectionTest,
  {Project: "Paid Sick"},
  {Project: "Unpaid Sick"},
  {Project: "Comp Time"},
  {Project: "Holiday"},
  {Project: "Vacation"}
)

2\Add a button into the gallery and set it's OnSelect property to:

Patch(
   collectionTest,
   Thisitem,
        {
            EmployeeName: Office365Users.MyProfile().DisplayName,
            Project: ProjectBox_8.Selected.Column2,
            Phase: Left(PhaseBox_6.Selected.Phase,3),
            Task: Left(TaskBox_6.Selected.Result,5),
            Comment: CommentInput4_4.Text,
            Total: TotalText_8.Text,
            Saturday: SatInput_8.Text,
            Sunday: SunInput_8.Text,
            Monday: MonInput_8.Text,
            Tuesday: TueInput_8.Text,
            Wednesday: WedInput_8.Text,
            Thursday: ThuInput_8.Text,
            Friday: WedInput_8.Text,
            Date: DatePicker1_18.SelectedDate,
            LaborCode: Left(LaborBox_6.Selected.LaborCode,3),
            rowNumber: CountRows(collectionTest),
            Company: LookUp(Table1, EmployeeEmail = User().Email, Company)
    }
)

Best Regards,

Bof

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 (4,739)