cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
mmattar
Level: Powered On

Locking an item in gallery for edit

Hello all,

 

I would like to be able to lock an item's form from editing based on date and time of the current week. So based on the current week, past Wedsnday noon, all items in the gallery with thier dates past the lock equation will be effected. 

 

I have something along the lines of this so far, just asking if this the best way of approach.

DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday)) && Hour(Now()) < 1

 

thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Locking an item in gallery for edit

Hi @mmattar,

Could you please share a bit more about your scenario?

Do you want to filter your Gallery items whose date column value is more than Wednesday noon of current week?

Based on the formula that you provided, I think there may have something issue with it.

I have made a test on my side, please take a try with the following workaround:8.JPG

Set the TemplateFill property of the Gallery to following:

If(
ProductionDate > DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday))+Time(12,0,0),
RGBA( 255, 105, 180, 1 ),
RGBA(0,0,0,0)
)

On your side, if you want to lock an item (whose date column value is more than Wednesday noon of current week) from editing within the Edit form, I afraid that there is no direct way to achieve your needs in PowerApps.

The user @cooltechie has faced same issue with you, please check my response within the following thread:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/How-to-make-a-Form-read-only-or-Disable...

As an alternative solution, you could consider make All Data cards within the Edit form disabled when the date column value of current record is more than Wednesday noon of current week). I have made a test on my side, please take a try with the following workaround:9.JPG

Set the DisplayMode property of All Data Cards within the Edit form to following:

If(
BrowseGallery1.Selected.ProductionDate > DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday))+Time(12,0,0),
DisplayMode.Disabled,
Parent.DisplayMode
)

On your side, you should type:

If(
BrowseGallery1.Selected.DateColumn > DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday))+Time(12,0,0),
DisplayMode.Disabled,
Parent.DisplayMode
)

Please check the attached GIF screenshot for more details.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Locking an item in gallery for edit

Hi @mmattar.

Set the DefaultMode of the form to 

If(DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday)) && Hour(Now()) < 1,1,2)

In the formula the Then Results of  the If function ,1 and 2 refer to Display modes of Edit and View. 

Community Support Team
Community Support Team

Re: Locking an item in gallery for edit

Hi @mmattar,

Could you please share a bit more about your scenario?

Do you want to filter your Gallery items whose date column value is more than Wednesday noon of current week?

Based on the formula that you provided, I think there may have something issue with it.

I have made a test on my side, please take a try with the following workaround:8.JPG

Set the TemplateFill property of the Gallery to following:

If(
ProductionDate > DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday))+Time(12,0,0),
RGBA( 255, 105, 180, 1 ),
RGBA(0,0,0,0)
)

On your side, if you want to lock an item (whose date column value is more than Wednesday noon of current week) from editing within the Edit form, I afraid that there is no direct way to achieve your needs in PowerApps.

The user @cooltechie has faced same issue with you, please check my response within the following thread:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/How-to-make-a-Form-read-only-or-Disable...

As an alternative solution, you could consider make All Data cards within the Edit form disabled when the date column value of current record is more than Wednesday noon of current week). I have made a test on my side, please take a try with the following workaround:9.JPG

Set the DisplayMode property of All Data Cards within the Edit form to following:

If(
BrowseGallery1.Selected.ProductionDate > DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday))+Time(12,0,0),
DisplayMode.Disabled,
Parent.DisplayMode
)

On your side, you should type:

If(
BrowseGallery1.Selected.DateColumn > DateAdd(Today(), 4 - Weekday(Today(), StartOfWeek.Sunday))+Time(12,0,0),
DisplayMode.Disabled,
Parent.DisplayMode
)

Please check the attached GIF screenshot for more details.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mmattar
Level: Powered On

Re: Locking an item in gallery for edit

Thanks Drrickryp for helping on the formula ! 

mmattar
Level: Powered On

Re: Locking an item in gallery for edit

This works for me ! thank you

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 175 members 4,455 guests
Please welcome our newest community members: