cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulPoco
Level: Powered On

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
Community Support Team
Community Support Team

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
Community Support Team
Community Support Team

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.
PaulPoco
Level: Powered On

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

Community Support Team
Community Support Team

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
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
Users Online
Currently online: 321 members 6,041 guests
Please welcome our newest community members: