web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery controls uniqu...
Power Apps
Unanswered

Gallery controls unique to a row rather than whole gallery

(0) ShareShare
ReportReport
Posted on by 17

Hello. I'm building my first power app to record timesheet data. I've created a functioning one that feeds to a sharepoint list but I'm trying to add some controls and restrictions to it. The timesheet is a gallery that is expanded with a button for new rows. What I'd like is when certain pay codes are selected in a drop down, Job Number and Sub Job are cleared and DisplayMode.Disabled.

 

I've got halfway there, but I can only get them all Disable or all Edit; I can't get it to work line by line I tried some solutions on the internet involving a collection to store variables unqiue to the line but I always ended up with data type errors.

 

I imagine there's an easy solution to it if somebody is able to help me?

I've attached a picture.

 

Thanks

Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    just to understand it a bit better all of the things in the screenshot is a gallery?

    if yes, why did u choose to place it in a gallery instead of just placing the fields i the app?

     

    mmbr1606_0-1701247115073.png

     

  • MudassarSZ365 Profile Picture
    591 on at

    Hi @edwardburton ,

    For the Dropdown: Set the OnChange property to update the current item's pay code property.

    UpdateContext({varSelectedPayCode: ThisItem.PayCode})

    put this code on the displaymode property of the dropdown

    DisplayMode = If(ThisItem.PayCode = "CertainPayCode", DisplayMode.Disabled, DisplayMode.Edit)

    on the onchange property of the dropdown put this code

    If(Dropdown.Selected.Value = "CertainPayCode", UpdateContext({varClearFields: true}), UpdateContext({varClearFields: false}))

    For the Default property of the Job Number and Sub Job controls, use:

    Default = If(varClearFields, "", ThisItem.JobNumber)

    If this information helps you, please mark it as the solution and leave a thumbs up. Thank you! 😊

     

  • edwardburton Profile Picture
    17 on at

    The gallery part is just the rows with the pay code and job number and day entry fields. The headings are not part of the gallery. It's in a gallery form so lines can be added and removed as the user needs.

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    so you choose 1 Job Name field but all 3 fields are gone once u placed a corresponding Pay Code?

  • edwardburton Profile Picture
    17 on at

    I can write code so that all the job name fields disable when I change any of the pay code drop downs. What I would like is only the job name field on the row of the dropdown I am changing to disable.

  • edwardburton Profile Picture
    17 on at

    Hello

    I don't think this quite does what I want but I've tried somethign based on this.

     

    In the OnChange property of the dropdown I've put this.

    If(drp_PayCode.Selected.Value = "2 - Contractor", UpdateContext({myvar: DisplayMode.Edit}),UpdateContext({myvar: DisplayMode.Disabled}))

     

    Then I've made the DisplayMode property of the JobNumber field myvar.

     

    The problem is if I have more than 1 row, when I change any paycode dropdown it updates all of the JobNumber fields. I would like it only to change the row it's on.

  • MudassarSZ365 Profile Picture
    591 on at

    @edwardburton ,

    DisplayMode property of the Job Number control.

    DisplayMode = If(drp_PayCode.Selected.Value = "2 - Contractor", DisplayMode.Edit, DisplayMode.Disabled)

     if the Job Number control needs to be disabled when a certain pay code is selected, the DisplayMode property of the Job Number Text Input within the gallery should be:

    DisplayMode = If(ThisItem.PayCode = "2 - Contractor", DisplayMode.Disabled, DisplayMode.Edit)

    Please apply this change and test it to see if it works as expected. If this resolves your issue, please mark the solution and leave a thumbs up. Thank you! 😊

     

  • edwardburton Profile Picture
    17 on at

    ThisItem.PayCode isn't producing a value. I've tried it and linked it to a text field but all it displays is null. Also It says it can't be compared to the text as it's a record, so I've had to wrap it in a JSON() to make it work.

    Is there a reason it isn't updating as I change the dropdown?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard