cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SSDhul92
Regular Visitor

How to disable a button if a current month value already exists in gallery in power apps

How to disable a button if a current month value already exists in gallery (Created Date) in power apps.?

Can any one Suggest.?

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Krishna_R
Resolver IV
Resolver IV

@SSDhul92  you can try this

 

If(IsEmpty(Filter(DataSource.CreatedDt, Month(CreatedDt) = Month(Now()))),DisplayMode.Edit,DisplayMode.Disabled)

or

If(IsEmpty(Filter(Gallery.Allitems, Month(CreatedDt) = Month(Now()))),DisplayMode.Edit,DisplayMode.Disabled)

 

View solution in original post

4 REPLIES 4
Krishna_R
Resolver IV
Resolver IV

Hi @SSDhul92 ,

if the created date is date type column and the button is inside of gallery. you can try this in the displaymode property of your button

 

If(Month(ThisItem.CreatedDt) = Month(Now()),DisplayMode.Disabled,DisplayMode.Edit)

 

Hi @Krishna_R 
The Button is outside the gallery. can you suggest in this scenario.

Krishna_R
Resolver IV
Resolver IV

@SSDhul92  you can try this

 

If(IsEmpty(Filter(DataSource.CreatedDt, Month(CreatedDt) = Month(Now()))),DisplayMode.Edit,DisplayMode.Disabled)

or

If(IsEmpty(Filter(Gallery.Allitems, Month(CreatedDt) = Month(Now()))),DisplayMode.Edit,DisplayMode.Disabled)

 

dwpzn
Regular Visitor

Hi Power Apps team.

 

Thank you this helped me solve a user to 1 site in my initial solution.

 

I need to Filter the below so that the "Manager" (CurrentUser) and multiple sites they access (SiteName) allows them to enter 1 entry per the multiple sites they need to.

 

The dropdown/combobox can Filter which Sites have not been captured for the current month. But also needed to know how to achieve that.

 

If(IsEmpty(Filter('Site Security Scorecard'.Date_of_ScoreCardEntry, Month(Date_of_ScoreCardEntry) = Month(Now()))),DisplayMode.Edit,DisplayMode.Disabled)

 

Update 1:

I have been able to add the logic for checking IF the User and Site are for the currently logged in User/Site along with the Month logic in the below.

 

But I think my syntax is wrong for checking the List field for Site User and Site Name. Can anyone guide me on what might be wrong with my syntax?

 

If(
IsBlank(
Filter(
'Site Security Scorecard'.Site_User = Label5_1.Text)
)
), && IsBlank(
Lookup(
'Site Security Scorecard'.SiteName = Label6.Text
)
), && IsBlank(
Filter(
'Site Security Scorecard'.Date_of_ScoreCardEntry,
(Month(Date_of_ScoreCardEntry) = Month(Now()))
)
),
DisplayMode.Edit,
DisplayMode.Disabled
)

 

dwpzn_1-1641384023570.png

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,887)