My app records a staff member's training record, and I want them to be able to come back and edit their record at any time.
At the moment, I have a 'Start' button which Navigates a new user to a NewForm, shown in the red box below. This works all good.
I have a second button which you can see in the bottom left of the screenshot above, which is a Gallery with the Items being:
LookUp(MatrixResponses,
User().Email = 'Email Address')
This means if a user has already submitted a record it shows that record, and then it navigates to the EditForm. This works by itself too.
My problem is trying to get the Gallery to hide when the lookup returns blank. I have tried a couple of different suggestions noted below, all with no luck.
1) Setting visible property of Gallery to:
If(IsBlank(LookUp(MatrixResponses,
User().Email = 'Email Address')), false, true)
which I believe should mean, if the lookup returns blank (as in, there is no matching email address), do not show the gallery. This returns true however even when the SharePoint list is completely empty
2) Setting the visible property of the gallery to:
CountRows(Gallery1.AllItems) = 1
This is also showing the gallery, even when the SharePoint list is completely empty
My plan is to layer the buttons on top of each other, and have the NewForm button visibility set to
If(Gallery1.Visible = true, false, true)
so if there is not a previous record the user makes a new one.
Am I missing something obvious? Is there an easier way to do this?
Solved! Go to Solution.
IsEmpty works against a string, but Lookup() returns a record. So your original formula for the visible property will work if you add a string field that will contain a value for each record retrieved. Title is usually a good choice since it is a simple text field and is required by default. So your formula should read
If(IsBlank(LookUp(MatrixResponses,
User().Email = 'Email Address').Title), false, true)
I would also save the user's email to a variable onStart and use that instead of the call to user().Email. Both will work, but getting the user's email once is better than doing it every time the screen is displayed.
IsEmpty works against a string, but Lookup() returns a record. So your original formula for the visible property will work if you add a string field that will contain a value for each record retrieved. Title is usually a good choice since it is a simple text field and is required by default. So your formula should read
If(IsBlank(LookUp(MatrixResponses,
User().Email = 'Email Address').Title), false, true)
I would also save the user's email to a variable onStart and use that instead of the call to user().Email. Both will work, but getting the user's email once is better than doing it every time the screen is displayed.
On the visible property of the gallery:
If(IsEmpty(Gallery1.AllItems),false,true)
Thank you - and to @joeinmay for both your quick responses! It's always those little bits which throw me out ๐ I ended up going with Pstork1's answer but only because it was the first one I read.
the early bird catches the worm ๐
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
253 | |
235 | |
82 | |
36 | |
27 |
User | Count |
---|---|
313 | |
265 | |
120 | |
68 | |
44 |