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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Default item in galler...
Power Apps
Answered

Default item in gallery with date items

(1) ShareShare
ReportReport
Posted on by 15
Hello community,
 
I have a gallery with the following items (weekdays of one week) where the input of "lbl_Monday_Hidden.Text" comes from a calendar week selection and contains the monday of the selected calender week.
ForAll(
    Sequence(
        5;
        0;
        1
    );
    {
        datum: DateAdd(
            lbl_Monday_Hidden.Text;
            Value;
            TimeUnit.Days
        )
    }
)
The gallery itself works as expected but I am not able to set the default property to the current date.
I tried different methods, from Today(), DateTime(Year(Today()); Month(Today());Day(Today());0;0;0), Text(Today(); "dd.mm.yyyy hh:mm:ss") but could not get it working,
 
Does anyone have an idea?
 
Thanks and kind regards
Joseph
 
Categories:
I have the same question (0)
  • D_D Profile Picture
    107 on at
    Hello Joseph,
     
    I did't understand what value you want to set to the current date. When I use this in a gallery I get the next five days starting from the current date.
    ForAll(
        Sequence(
            5,
            0,
            1
        ),
        {
            datum: DateAdd(
                Now(),
                Value,
                TimeUnit.Days
            )
        }
    )

    So i guess the value from lbl_Monday_Hidden.Text causes the problem. What value does lbl_Monday_Hidden.Text view when you add it as text in a label control?

    --------------------------------------------------------------------------------------
    If this helps you or solved your question, please like or mark this as an answer.
    Best regards, David
  • JS_PA Profile Picture
    15 on at
    Hi D_D,
     
    thanks for the quick reply.
    When I open the app the current date in the gallery should already be preselected - therefore I wanted to add Today() in the Default property.

    lbl_Monday_Hidden.Text is of Type "Date":

     
     
  • Suggested answer
    D_D Profile Picture
    107 on at
    Ok, for me it worked when the value from lbl_Monday_Hidden.Text is stored in a variable and then use the variable in your formula. For dynamically changes you always have to use valiables instead of values of control elements.
    ForAll(
        Sequence(
            5;
            0;
            1
        );
        {
            datum: DateAdd(
                variableNameHere;
                Value;
                TimeUnit.Days
            )
        }
    )
    --------------------------------------------------------------------------------------
    If this helps you or solved your question, please like or mark this as an answer.
    Best regards, David
  • JS_PA Profile Picture
    15 on at
    Thank you.
    The items themselves worked before - but the default item is still the problem, as it says that it is not an element of the items, even though the items are of type date...
  • D_D Profile Picture
    107 on at

    I think I completly missed the point before. So what you are looking for is a default value for the Gallery?
    The Items of the Gallery are of Type

    {datum: Date}

    So a default Value for the Gallery could be

    {datum: Today()}

     
  • Verified answer
    JS_PA Profile Picture
    15 on at
    Thanks for the response.
     
    I ended up by setting the today indicator circle to visible if
    ThisItem.datum = gblSelected
    where in OnVisible of the screen gblSelected is defined as
    Set(
        gblSelected;
        Today()
    )
    This results in:
     
    Before this implementation I tried to show the circle with "ThisItem.IsSelected".

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 96 Super User 2026 Season 1

Last 30 days Overall leaderboard