cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Samny_98
Helper IV
Helper IV

Increment Number and backup

Hello all,

 

I created a label which counts every time that I click on a button.

However, the value of this label is not saved when I close the application. Can you help me in order to save the value of this label ?

 

Previously, I made :

 

Set(Counter, 0) in On Start of App.

Set(Counter, counter +1) in OnSelect of my Button.

counter in Text of my label

 

 

Many greetings.

 

Samuel.

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Samny_98 ,

 

Please try:

1\navigate to Settings > Upcoming features > Experimental > Enabled SaveData, LoadData, ClearData on web player.

vbofengmsft_0-1652249805296.png

2\OnStart

LoadData(TheDateSource,"LocalCounter");If(IsEmpty(TheDateSource),Set(Counter,0),Set(Counter,Value(First(TheDateSource).Value)))

3\OnSelect

Set(Counter, Counter +1);ClearCollect(TheDateSource,Counter);SaveData(TheDateSource,"LocalCounter")

I think this link will help you a lot:

SaveData, LoadData, and ClearData functions in Power Apps 

 

Best Regards,
Bof

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

yes, you need to save this in some place, could be in a sharepoint list, or excel, or  any other database what you want.

v-bofeng-msft
Community Support
Community Support

Hi @Samny_98 ,

 

Please try:

1\navigate to Settings > Upcoming features > Experimental > Enabled SaveData, LoadData, ClearData on web player.

vbofengmsft_0-1652249805296.png

2\OnStart

LoadData(TheDateSource,"LocalCounter");If(IsEmpty(TheDateSource),Set(Counter,0),Set(Counter,Value(First(TheDateSource).Value)))

3\OnSelect

Set(Counter, Counter +1);ClearCollect(TheDateSource,Counter);SaveData(TheDateSource,"LocalCounter")

I think this link will help you a lot:

SaveData, LoadData, and ClearData functions in Power Apps 

 

Best Regards,
Bof

 

Samny_98
Helper IV
Helper IV

@v-bofeng-msft 

 

Thanks but I have an issue with  :

If(IsEmpty(TheDateSource),Set(Counter,0),Set(Counter,Value(First(TheDateSource).Value)))

 

I replaced TheDateSource by T04_Weekends which is my table associated to my DataTable.

I have this error : "The "Value" function comes in invalids arguments.

The name is not valid "Value" is not known.

 

 

Hi @Samny_98 ,

 

You do not need to replace the TheDateSource with T04_Weekends, just copy my formula completely and I think you will get it working.

 

Best Regards,
Bof

@v-bofeng-msft

 

I have Runtime errors. It doesn't work.

In OnSelect, for the SaveData formula, I have : " An issue happened during the breakup of the datas". "This recording is impossible if execution in a web browser"

In OnStart, for the LoadData formula, I have : "An isssue happened during the loading of yours datas. You can't load datas from a web browser".

 

Hi @Samny_98 ,

 

You could igno this error and then save and publish this app if you truned on this feature:

vbofengmsft_0-1652263163685.png

 

 

It will work fine when the users run the app on browser or Mobile phone.(An error will be reported when it is run for the first time, because the collection has not been saved locally, and an error will not be reported when it is run for the second time.)

 

Best Regards,

Bof

Helpful resources

Top Solution Authors
Top Kudoed Authors
Users online (3,636)