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.
@mdevaney thanks for getting me there. I wound up using this for the Visible property on the Delete Row button:
If(CountA(Collection.Column)=1, false, true)
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?
@mdevaney thanks for getting me there. I wound up using this for the Visible property on the Delete Row button:
If(CountA(Collection.Column)=1, false, true)
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.
User | Count |
---|---|
135 | |
132 | |
79 | |
75 | |
71 |
User | Count |
---|---|
210 | |
197 | |
69 | |
62 | |
53 |