I've followed Shane Young's YT series on making a repeating section. I have a question regarding the details gallery. Is there any way to prevent a user from accidentally removing the last line in a gallery?
Solved! Go to Solution.
My assumption is your Gallery will be ordered from lowest to highest ID. You can use the MAX function to determine the greatest value within the field ID . Put this code in the DisplayMode property of your delete record button.
If(ThisItem.ID = Max(your_datasource_name,ID), Disabled,Edit)
Note: I've not watched Shane's video on this topic so I am making some assumptions here.
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
I feel like you're definitely on to something here. I'm not currently keeping track of ID though. My datasource is just a collection with a single text column in it. Would I need to build an incrementing ID column in it, or do you think I could use something like Count? Maybe if I count the rows in the collection and it's equal to 1?
Ah, yea! I see what you mean. In my mind, you had multiple lines and you were deleting them 1 by 1. At some point, your last line(meaning the last one remaining) I wanted to prevent being deleted. Not actually THE last line in the collection. I see how my explanation was confusing haha.
Check it out!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand