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.
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".
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.
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?
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.
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.
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).
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.