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

Assign value to text label from gallery content updated after a refresh

Hello,

I have a gallery with a Sharepoint data source, which is refreshed automatically when new, edit or deleted item.

that gallery is filtered based on selected values in a form.

I'm counting the hours with Begin/End date value from my list. And I'm counting the total of hours of each listed item.

I'm doing it with a button (code below), but I would like to have this count automatically processed each time the gallery is refreshed.

Then I was trying to use some code in the Text param of the Label... but it doesn't work... 

I hope someone can help me on this

<Button> OnSelect:

 

Clear(HoursColl);
ForAll(GalleryList.AllItems,
        Collect(
            HoursColl,
            DateDiff(Subtitle2, Title2, Minutes)/60
        )
    );

 

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
LGE
Regular Visitor

I was not able to make the OnTimerEnd function to be triggered properly.

But I use an hidden button to activate my function and use UpdateContext changing the Start variable defined from True to False.

 

View solution in original post

7 REPLIES 7
venka91
Super User
Super User

The collection must be generated when you fire events on controls. Like OnSelect, OnChange etc.

So on Form Submit, you may try this collection formula so the Label, automatically displays the value.

LGE
Regular Visitor

Good idea,

indeed the calcul is triggered, but the refresh of the gallery datasource was not completed then it does not provide latest input

For info the gallery is on the same screen and refresh automatically after form is submitted.

I have also another screen to edit entries with another submit, but this is not fired then when navigating back to the screen with the gallery the label is not updated.

Hi @LGE ,

 

Maybe you could try to use Timer Control to refresh the datasource automatically.

Refresh(datasource)

https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/functions/function-refresh#syntax

vyujincuimsft_0-1651477505999.png

 

 

Best Regards,

Charlie Choi

LGE
Regular Visitor

@v-yujincui-msft good idea, but the problem is not on the refresh of the datasource but on the calculation after the gallery has been updated following a refresh... 

Ideally I need to call the calculation AfterRefresh. How to trigger this kind of action?

 

Hi @LGE ,

 

Maybe you could try to put the formula for the calculation and the formula for refreshing the data source in the same Formula bar.

vyujincuimsft_0-1651478899907.png

 

Best Regards,

Charlie Choi

 

LGE
Regular Visitor

I was not able to make the OnTimerEnd function to be triggered properly.

But I use an hidden button to activate my function and use UpdateContext changing the Start variable defined from True to False.

 

Hi @LGE ,

 

When the timer ends, the formula in the OnTimerEnd property will be executed.

vyujincuimsft_0-1651547398941.pngvyujincuimsft_1-1651547419655.png

Here is a link that might help you:

https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/controls/control-timer#key-properties

 

Best Regards,
Charlie Choi

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,086)