I have a gallery in Power App that shows a list of incidents. I want to show how long ago the incident was opened.
I have a timer on the screen that updates a context variable every second. That works well, when I show the value of the variable in a label, I see the current time increasing every second.
In my Gallery, the value I show is Datadiff(StartDate, MyContextVariable, Minutes). In theory, I believe this should show and increasing number of minutes. However it looks like my calculation take the value of the context variable at "some" point and never updates it?
Any idea on how to make that work?
Solved! Go to Solution.
Hi @PaulPoco,
Have you solved your problem?
If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved for other users.
In addition, I think the solution I provide could also achieve your needs, please take a try with it.
Best regards,
Kris
Hi @PaulPoco,
How do you initialize and update the MyContextVariable within your app? Could you please share a bit more about the formula?
Do you want to calculate the duration of the incident from the Start Date to Now (current time)?
I have made a test on my side, and don't have the issue that you mentioned. Please take a try with the following workaround:
Within the Gallery, set the Text property of the Duration Label control to following:
DateDiff(ThisItem.Created, MyContextVariable, Minutes)
Set the Duration property of the Timer control (Timer1) to following:
1000
Set the Repeat property and AutoStart property of the Timer control (Timer1) to following:
true
Set the OnTimerEnd proeprty of the Timer control (Timer1) to following:
Set(MyContextVariable, Now())
Note: Please use global variable (using Set() function) to store your MyContextVariable value rather than Context variable.
Please check the following attached GIF screenshot for more details:
Best regards,
Kris
Thank you for you answer,
I managed to make it work since then. I believe my solution was very close to yours.
As of now the only difference is that the time updates a context variables, a Label shows the context files and the gallery uses the Label.text to make all calculations. That works and I use the timer label as a watch which is usefull, my application being used for a very time sensitive matter.
Thanks
Hi @PaulPoco,
Have you solved your problem?
If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved for other users.
In addition, I think the solution I provide could also achieve your needs, please take a try with it.
Best regards,
Kris
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
207 | |
187 | |
83 | |
52 | |
37 |
User | Count |
---|---|
288 | |
245 | |
119 | |
77 | |
56 |