cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Count Variable

Hello everyone,

 

I need to create a variable that counts "+1" every day. I need this count to clear if my SharePoint list is set to "0" on the specified line.

 

My biggest question is how to create this variable that counts every day.

 

List: DateTurn
Column: Accident

8 REPLIES 8
Microsoft dinusc
Microsoft

Re: Count Variable

A bit more clarification would be helpful. If I understand the intended behaviour correctly, it looks like all you need is to store the current date in a variable (start_date) every time you find "0" in the specified column. When you need the proper count, you just need to get the current date and calculate the number of days between start_date and that date.If the last time you detected the "0" was 2 days ago then your count will be "2".

Community Support Team
Community Support Team

Re: Count Variable

Agreed with @dinusc here.

 

For the current date when the "0" is found with the specified column field, it is recommended to store that information at the data source side. (You could also take use of SaveData function to keep that with the local device, but that would require the App to be opened with the same device, in order to get the proper saved date)

As the Variable saved within App would clear its value when the App is closed and open again.

 

If this is not meet your requirements, then please share more details and we will see if a more suitable solution could be offered.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Re: Count Variable

It would not be enough, because I need a variable to count until, in the SP list, you enter the time to zero and return to "0".

 

I can clear the variable. But I just can not get her to count +1 every day

I need to know a way I can count it every day, without having to store it anywhere. It would be possible?

Highlighted
Microsoft dinusc
Microsoft

Re: Count Variable

Hello Antonio,

Does the counter need to run in the applciation? For example, if I start the app and I see the counter = 4. Then the next time the application is started is in 2 days and when I start the app, the counter should be 6 (assuming the sp list did not have the time set to 0). In this case the counter state has to be saved somewhere in order to update it properly (since the app does not run 24/7). 

Would you be able to share a bit more details about the intended behavior? I feel like there should be a much easier solution to the problem you're trying to solve.

Anonymous
Not applicable

Re: Count Variable

Hello dinusc!

That's right, I need a counter within the application, regardless if it will be opened every day or not (but will open every day yes). But how could I make an accountant in OnStart for example? Increase "+1" every time this app starts? It would be an option too.

Microsoft dinusc
Microsoft

Re: Count Variable

You can definitely use the OnStart property. The problem is that after incrementing your counter, you would have to store it somewhere anyways in order to prevent losing that value when the application is turned off. After re-opening the application (the next day) you somehow need to retrieve the last value of the counter so you can increment it (if the time is not reset). 

Anonymous
Not applicable

Re: Count Variable

I understood now .. But I would not use a row for each incremental number right? Because otherwise it would get too big!

Microsoft dinusc
Microsoft

Re: Count Variable

No. This is why initially I was suggesting just to store the day value when the counter is reset (the empty time column situation). The only case you would have to store multiple day values is in case you would prefer to reset different application at different times (for example, when you have multiple "time" columns). In that case, I would just suggest either adding a new "reset_day" column to your existing list or creating a separate list to track that information.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,878)