cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,080)