Forum Discussion
Filter my Gallery by Current Month
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,
9 Replies
- jonlakeIron Contributor
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.
- ADumithIron Contributor
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,
- jonlakeIron Contributor
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').