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 / 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

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard