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 / 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:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,989 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,989 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

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