Apr 13 2022 02:06 PM - edited Apr 14 2022 08:22 AM
Hi guys,
I have a gallery view that contains record from a sharepoint list, in that one there is a field called MBirth, this is a single line text, so How can I filter my list that field? I mean, myfiel being equal to current month.
This is the expression that I'm trying to use:
Filter('Birthday and Work Anniversary','Birthday and Work Anniversary'.MBirth = Month(Now))
But it's not working.
This is an expression that I have in my workflow and working perfect, so if I could convert it to use in powerapps it would be great.
Query filter:
MBirth eq 'fomatDateTime(utcNow(),'MM')'
So, if my record is set to MBirth eq 04 and that's expression return 04, I'll well get all the records.
Could you help me with this?
Thanks in advance,
Apr 14 2022 10:49 AM - edited Apr 14 2022 11:28 AM
Hi @ADumith , I recommend setting a variable on start for the current month, formatted to match the format in your source list, then after you've set that variable create your collection filtered by that variable. You would than set the collection as the source for the gallery.
Apr 14 2022 01:48 PM
Great idea,
I did this:
In the items I added this:
In my list the field is set like a single line text, so mi record has 04 instead of 4.
Where is the error? 😞
Thanks in advance,
Apr 14 2022 02:18 PM - edited Apr 14 2022 02:18 PM
Hi @ADumith , immediately after you create the variable on start, add a line to create your collection, something like this: ClearCollect(colBirthDayWorkAnniversary,Filter(birthday_and_workanniversary,mbirth=varMonths));
Your gallery object items would then use the newly populated collection (in my example the SharePoint list is named 'birthday_and_workanniversary').
Apr 15 2022 09:43 AM
Thanks for your time,
I renamed the list to avoid errors.
So the code in the OnStart method looks like this:
Set(varMonths, Text(Today(),"mm"));
ClearCollect(colBirthDayWorkAnniversary,Filter(EmployeesDirectory,Mbirth=varMonths))
Then in the gallery DATA property I put what I understand would be the name of the collection, I mean, colBirthDayWorkAnniversary
When I run the apps no record is shown in the gallery. Am I skipping a step?
Thanks again,
Apr 15 2022 09:57 AM
Hi @ADumith, you need to set the gallery items property to the collection (colBirthDayWorkAnniversary).
Apr 15 2022 10:05 AM
Apr 15 2022 10:12 AM
Hi @ADumith , click the edit icon (the pencil) and add in label fields and map them to the fields in the collection.
Apr 15 2022 10:32 AM - edited Apr 15 2022 11:09 AM
Hi @jonlake
The fields are mapped.
But I think the problem is elsewhere, look at the images.
The collection is not bringing any records, in fact the fields that are shown do not correspond to the list that I have in SharePoint.
One question: The declaration of the variable is made in the OnStart (App) method and the collection too or should it be placed in OnVisible (Screen) or do they both go together?
Thanks for your patience and support, I'm new to PowerApps.
Apr 15 2022 11:32 PM
Hi @ADumith , I see you've started a separate continuation thread: Collection not populating