How to create a counter?

Hiโ€ฆ
I have an app that records surgery details. Thereโ€™s an Enum type column called [Surgery Status], that has 3 values - Done, Pending, Postponed.
If a particular patientโ€™s surgery gets postponed, just tapping โ€˜Postponedโ€™ in the [Surgery Status] column should record a value of 1 in a Number type column called [Postponed Times]. Now, once this postponed patient gets rescheduled for surgery, the person who maintains the app will change the [Surgery Status] to โ€˜Pendingโ€™, and still that should keep the value 1 in the [Postponed Times] column which was previously recorded when the surgery got postponed (because the patient was postponed once). Now letโ€™s say, this patientโ€™s surgery gets postponed again for the second time also, and now the person who maintains the app changes the [Surgery Status] again to โ€˜Postponedโ€™. When that happens, I want that [Postponed Times] column to record the value 2, as now this patientโ€™s surgery got postponed twice. I want this going on for as long as the patientโ€™s surgery status changes from pending to done (letโ€™s say if the surgery gets postponed 4 times, I want the [Postponed Times] column to record the value 4 automatically).

I wrote an expression to the [Postponed Times] Number type columnโ€™s app formula
IF([Surgery Status]=โ€œPostponedโ€,[Postponed Times]+1,[Postponed Times]+0)

While it does work, only issue is, when ever the same patientโ€™s data row is accessed via the edit button to change some other info of the patient, if the [Surgery Status] is kept at the โ€œPostponedโ€ value for the patient, this adds a +1 value to the [Postponed Times] column again which I donโ€™t want to happen. Is there a way to mitigate this issue and just maintain an authentic counter for the number of times the surgery gets postponed for the patient?

Thanks a lot

0 2 891
2 REPLIES 2

Steve
Platinum 4
Platinum 4

I would suggest using actions to modify the Surgery Status column, rather than allowing the user to set the columnโ€™s value directly. With an action, you can both increment the counter and change the status (if appropriate) at one time with only a single tap by the user.

Thank you Steve. I had to resort to what you suggested. And it works for me. Thank you very much!

Top Labels in this Space