I received a number of errors when inputting this.
I had to (unfortunately) create a new app based on a new table.
This is what I put for the "App" in the "OnStart" box:
Then in the BrowseGallery1 in "Items":
SortByColumns(Filter([@'Rep 1 Test'], StartsWith(Title, TextSearchBox1.Text)&& 'CreatedBy'.DisplayName=_User().FullName),"Title", If(SortDescending1, Descending, Ascending))
I got 5 errors for the BrowseScreen1
It won't be _User().FullName ...it is either User().FullName or _CurrentUser on the filter and for the Set part, if that is what you are using it needs to be Set(_CurrentUser, User().FullName)
Instead of two options lets do:
App - OnStart = Set(_CurrentUser, User().FullName)
(after you put this in click on the three dots next to App and click the "Run OnStart" , this will make it set that variable). To double check it is set you click at the top View/Variables and it should be listed as a Global variable there.
For your Gallery Filter it should be _CurrentUser instead of the _User().FullName
If it where me I would change that to say:
SortByColumns(Search(Filter, 'CreatedBy'.DisplayName=_CurrentUser), TextSearchBox1.Text, "Title"),"Title",If(SortDescending1, Descending, Ascending))
If I know my data is good I don't concern myself with delegation warnings, I dislike StartsWith, but if they bother you then you can do a few extra steps and still have it work good with no warnings.
Create a collection on the screens load that filters for only the persons items and then you can put the collection in place of your data source name on your original items:
Screen with gallery - OnVisible= ClearCollect(CollMyItems, Filter('Rep 1 Test', 'Created By'.DisplayName=_CurrentUser))
Gallery Items = SortByColumns(Filter(CollMyItems, StartsWith("Title", TextSearchBox1.Text)),"Title", If(SortDescending1, Descending, Ascending))
The first thing I notice is that you are setting _CurrentUser as the variable, but then using _User().Fullname in your filter. If the user is stored as _CurrentUser then it should read _CurrentUser.Fullname. I think that's actually the source of all 5 of your errors.
Sorry..on that last post I noticed the Set I had is missing ()
See once you do that first part it is storing the current users name as a text field that can be referred to anywhere else in the app so from there you will be able to refer to it like it is just a text.
** I just went and fixed it, getting confusing**
Ok that worked so far. But then it broke the delete function.
OnSelect = Remove([@'Rep 1 Test'], BrowseGallery1.Selected); If (IsEmpty(Errors([@'Rep 1 Test'], BrowseGallery1.Selected)), Back())
HI @bmurphy1 ,
Could you please share a bit more about the issue with your Remove formula?
Do you mean that the IsEmpty(Errors(...)) could not work when you remove an record from your Gallery?
Please consider take a try with the following workaround:
Set the OnSelect property of the Gallery to following:
Set the OnSelect property of the "Remove" button to following:
RemoveIf( [@'Rep 1 Test'], ID = CurrentItem.ID ); If( IsEmpty( Errors([@'Rep 1 Test'], CurrentItem) ), Back() )
Remove([@'Rep 1 Test'], BrowseGallery1.Selected); If( IsEmpty(Errors([@'Rep 1 Test'])), Back() )
Please consider take a try with above solution, check if the issue is solved.
If your Remove is outside the gallery (which I am assuming it is from what you put) you are not selecting an item in the gallery from the [@'Rep 1 Test'] anymore you are selecting an item from the collection. You just need to add a LookUp instead to find the item you are removing. Something like:
Remove(LookUp([[@'Rep 1 Test'], ID=BrowseGallery1.Selected.ID)
This is telling it to remove the item from your data source that has the same ID as the item in your gallery that is selected's ID.
Since you have the Back() part on the end it will refresh the collection when you come back to the screen BUT if you ever wanted it to do this action and stay on the same screen keep in mind that you would need to do that Remove, then a Refresh() of the data and then gather your collection again for it to update the items showing in the gallery. Not a big deal to do, and not needed hear but just figured it was worth mentioning.
The gallery is empty when you first open the app, but after you create a new contact and finalize it then all the previous contacts appear in the gallery. How do I fix that?
It sounds like maybe after you create the new one and refresh your collection that you don't have the filter on that part also. Whatever you filter for to create the collection at the beginning you will need to do the same after the changes are made and you update your data.
It is clearing and starting fresh so it won't know what you asked for before.
Keep your eyes open for our upcoming T-shirt design contest!
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