So, I'm trying to teach myself PowerApps from a variety of sources and seem to be failing at the first hurdle and would be appreciative of someones input so I can move on in my PowerApps travels.
I have set up, what should be, a very simple scenario to test the use of Global variables.
Simple screen, when I select "App" on the treeview, I select the "OnStart" property and declare two global variables:-
Set(LabelText,"");
Set(_CurrentWeekNo, RoundDown((RoundUp(Today()-Date(Year(Today()-Weekday(Today()-1)+4),1,3),0)+Weekday(Date(Year(Today()-Weekday(Today()-1)+4),1,3))+5)/7,0))
The second declaration is meant to calculate the week number of the current date, I found the equation online, I'm not too bothered whether it gives the right answer at the moment, I'm simply trying to actually use the variable in a screen.
In Screen1 I then have 3 items:-
LabelHello, simple label, only property set is the text property which is set to the variable LabelText
Button1: onselect property set to Set(LabelText,Text(_CurrentWeekNo,"[$-en-GB]0"))
Button2: onselect property set to Set(LabelText,"")
The idea is when the app is run, the label should start blank then if I click Button1, the label text should display the week number, if I click button2, the text should clear.
As I said, should be easy, it's just not working ie button1 doesn't display the current week number.
Any help / guidance anyone can provide would be really welcome.
Thanks in advance