cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Duration calculated in Gallery not updated

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Duration calculated in Gallery not updated

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

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Duration calculated in Gallery not updated

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:11.JPG

 

12.JPG

 

13.JPG

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

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Duration calculated in Gallery not updated

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

Highlighted
Community Support
Community Support

Re: Duration calculated in Gallery not updated

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

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,465)