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 / Why is my value not be...
Power Apps
Answered

Why is my value not being saved?

(0) ShareShare
ReportReport
Posted on by 894

I am trying to save the result of Text(Now(), "[$-en-US]ddd") as a variable.

If I set the Text of a Label control to Text(Now(), "[$-en-US]ddd"), this works fine. Today it displays 'Thu'

I want to use this value to provide default data.

I have tried UpdateContext({gvDayName:Text(Now(), "[$-en-US]ddd")}); and Set(gvDayName,Text(Now(), "[$-en-US]ddd")); in  the OnVisible property of my screen.

When I run it and view the variables, gvDayName has no value.

Why is this not working?

 

Categories:
  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @stapes 

    Your code 100% works.  However, it only runs when you change screens 🙂

     

    Put this code in the OnVisible property of the screen

    Set(gvDayName,Text(Now(), "[$-en-US]ddd"))

     

    Next, put this code in the OnHidden property of the screen.

    Set(gvDayName,Blank())

     

    Create a new label and use this code in the Text property.

    gvDayName

     

    Now click on a different screen in PowerApps Studio.  Then click on the screen you placed the label in.  It should work!

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • stapes Profile Picture
    894 on at

    Thanks @mdevaney - but that does not make any sense.

    I have already put this in my OnVisible property, and it does not work. 100%

    Everything else I have put in there does work, and there is a lot of it. Too much for these tiny frames, if you ask me:

     

    Set(LoadingSpinnerVisibility,true);
    Coalesce(gvSelectedYear, gvDefaultYear);
    Coalesce(gvWeekNo,gvDefaultWeek);
    Coalesce(gvStartOfWeek, true);
    If(gvStartOfWeek, UpdateContext({toggle2:true, toggle3:false, toggle4:false, toggle5: false, toggle6:false}));
    If(gvStartOfWeek, Set(gvStartOfWeek, false));
    ClearCollect(outstandingOrders,GoodsInToday.Run(gvWeekNo, gvSelectedYear, gvDaySelected)
    );
    Set(LoadingSpinnerVisibility,false);

     

    I have chosen a Global Variable so that it will hold it's value when I change screens, so why would I want to do Set(gvDayName,Blank())?

     

    I have also tried putting this in the OnStart property of the App. The line above it works. Why not this?

     

    Set(gvDefaultYear,
    Value(Text(Today(),"[$-en-US]yyyy")));
    Set(gvDayName,(Text(Today(), "[$-en-US]ddd")));
    Set(gvDefaultWeek,
    If(RoundDown((Today() - Date(Year(Today()), 1, 1) + (Weekday(Date(Year(Today()), 1, 1) - 1, Monday))) / 7, 0) = 0,
    52,
    RoundDown((Today() - Date(Year(Today()), 1, 1) + (Weekday(Date(Year(Today()), 1, 1) - 1, Monday))) / 7, 0)+1)
    );
    Set(gvDefaultDay,2);
    Set(gvDaySelected, gvDefaultDay);
    Set(gvSelectedYear, gvDefaultYear);
    Set(gvWeekNo,gvDefaultWeek);
    Set(gvStartOfWeek, true);

     

     

     

     

  • stapes Profile Picture
    894 on at

    OK. This problem has solved itself. I had to close the app in the edit screen & reload it. Then it worked.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @stapes 

    Awesome.  Glad that you are now unstuck!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard