web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApp form with Cal...
Power Apps
Unanswered

PowerApp form with Calendar Screen template

(1) ShareShare
ReportReport
Posted on by 212

I have a powerapps form to submit requests for processing where the submitter can select a date. The default Date picker control is limited as I want to include a criteria for when a date is available for selection so I am replacing the date picker control with the Calendar Screen template in PowerApps.

 

In the Calendar Screen template, I have added a Vertical Gallery (Gallery4) to the MonthDayGallery. Gallery4 items is a filter on a SharePoint list that populates calendar dates where the Start Date and End date have a date value. Purpose is to identify that's are not available for selection.

 

Filter(
BlockDays,
DateAdd(
_firstDayInView,
ThisItem.Value,
TimeUnit.Days
) >= StartDate && DateAdd(
_firstDayInView,
ThisItem.Value,
TimeUnit.Days
) <= EndDate
)

 

How can I disable the selection or add a validationt to a button to check the dateselected to filter in the list to see if those dates are not available for selection throw an error or prevent user from selecting the date.

 

mthiru_0023_0-1702996549368.png

 

 

Categories:
I have the same question (0)
  • Verified answer
    KeithAtherton Profile Picture
    3,705 Most Valuable Professional on at

    If you need to prevent selection of dates which are blocked (say, in a collection called BlockDays), add the following code to the calendar date OnSelect property to notify the user.

     

    Please note that this code will require some trial-and-error depending on the field names in use.

    If(!IsEmpty(Filter(BlockDays, DateValue = ThisItem.DateValue)),
     Notify("This date is blocked and cannot be selected.");
    );

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • mthiru_0023 Profile Picture
    212 on at

    @KeithAtherton 

    I tried with this below expression but it does not do anything.

    If(!IsEmpty(Filter(BlockTradingDays, DateValue(ThisItem.Value)=_dateSelected)), Notify("Block"););

    mthiru_0023_0-1703024590091.png

     

  • KeithAtherton Profile Picture
    3,705 Most Valuable Professional on at

    If you select BlockTradingDays and _dateSelected in the formula bar, what values are displayed?


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • mthiru_0023 Profile Picture
    212 on at

    BlockTradingDays is Table, but did not find any data (odd). Maybe the Filter is working in that regard since _dateSelected shows as blank. 

     

    _dateSelected = Blank.

     

    I am not sure how to work with the _dateSelected variable here, as per microsoft ref it sets the date of variable of the selected cell.

     

    Title5_1 OnSelect Property has this meaning it's supposed to apply the

    Set(_dateSelected, DateAdd(_firstDayInView, ThisItem.Value, TimeUnit.Days));

     

    Property: OnSelect
    Value: A Set function that sets the _dateSelected variable to the date of the selected cell:

    Reference information about the calendar-screen template for canvas apps - Power Apps | Microsoft Learn

     

  • mthiru_0023 Profile Picture
    212 on at

    Alternatively, I can show a block Icon in the MonthDayGallery1_1:

     

    Using the following expression:

    CountRows(Filter(BlockTradingDays,
    DateValue(Text(StartDate)) <= DateAdd(_firstDayInView,ThisItem.Value,TimeUnit.Days),
    DateValue(Text(EndDate)) >= DateAdd(_firstDayInView,ThisItem.Value,TimeUnit.Days)
    )) > 0 && !Subcircle1_1.Visible && Title10_1.Visible

     

    mthiru_0023_0-1703085951571.png

    If I disable the selection will be added value.

  • KeithAtherton Profile Picture
    3,705 Most Valuable Professional on at

    As you say, looks like _dateSelected is not being set correctly. I would suggest investigating that to start with.

     

    The code in your example looks good. What is the value of _firstDayInView?


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard