cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SSDhul92
Frequent 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
Responsive Resident
Responsive Resident

@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
Responsive Resident
Responsive Resident

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
Responsive Resident
Responsive Resident

@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 Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,622)