cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Power Participant
Power Participant

Refresh variable from selected item (Collection)

Hi

 

How do you update a variable from a collection on a selected item from a gallery?

Currently im using the following.

 

Refresh(Datasource);
ClearCollect(MyCollection, Filter(Datasource, Lower(Requester.Email) = Lower(User().Email)));

 

Is it possible to refrehsh the screen for the select item displaying so if the item is update when i already have selected ut i want to fresh it and show the latest added text.

 

Column in sharepoint named "Column1"

Screen in powerapps displaying the text in "Column1"

 

How can i refresh that specific item showing on the screen? Or is my code above enough to do this?

4 REPLIES 4
Highlighted
Power Participant
Power Participant

To clarify.

 

When i push a button to save my input i want the variable to fetch and update the input so the new input is displayed instantly when i press save button.

Highlighted
Community Support
Community Support

Hi @JimmyWork ,

 

Is it a standalone app or custom form in SharePoint? 

 

Refresh(Datasource) will update all the items to the latest, so I think your formula already did what you need.

 

Regards,

Mona

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

@v-monli-msft Thank you for answering

 

It's not working on my save button, but it is working on my refresh button.

When i click save i want it to display the new text right away, but for some reason it does not work.

 

My save button On select = 

If(
!IsBlank(RichTextEditorComment.HtmlText),
Patch(
Datasource,
Gallery1.Selected,
{
'Case Comments': "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
Char(13) & RichTextEditorComment.HtmlText & Gallery1.Selected.'Case Comments'
}
)
);
Reset(RichTextEditorComment);
Refresh(Datasource);
ClearCollect(RecordsTickets, Filter(Datasource, Lower(Requester.Email) = Lower(User().Email)));
Set(varSelectedTicket, Gallery1.Selected);

 

My refresh button =
Refresh(Helpdesk);
ClearCollect(RecordsTickets, Filter(Datasource, Lower(Requester.Email) = Lower(User().Email)));
Set(varSelectedTicket, Gallery1.Selected);

 

Now the refresh button works for some reason but the save will not display the latest added comment until i press refresh.

 

My box displaying what i enter/save is a htmltextbox = varSelectedTicket.'Case Comments'

Highlighted

For some reason it only updates on the second refresh.

 

So now i have to the following.

 

Refresh(Datasource);
ClearCollect(RecordsTickets, Filter(Helpdesk, Lower(Requester.Email) = Lower(User().Email)));
Set(varSelectedTicket, Gallery1.Selected);
Refresh(Datasource);
Set(varSelectedTicket, Gallery1.Selected);

 

But if i have Galler1.Selected.'Case Comments' in the HtmlText box instead of (varSelectedTicket.'Case Comments') i dont need to refresh 2 times but i get a peformance warning because im not using a variable from my first screen. But refreshing from a collection seems to need 2 refresh?

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (3,124)