cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimmyBoy
Post Patron
Post Patron

Error on Label to set updatecontext

Hello,

Is there an way around to add this into the label text?

If(CountRows(MyGallery_1.AllItems)>0,
"Count items: " & CountRows(MyGallery_1.AllItems);UpdateContext({IsNotFound:false})

,
"Count items: " & CountRows(MyGallery_1.AllItems);UpdateContext({IsNotFound:true})
)

Because i get a error on the UpdateContext

TimmyBoy_0-1670552420096.png

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @TimmyBoy ,

You cannot set UpdateContext in the Text of a Label - it needs to be a separate action - either that or do this on a button/icon

With(
   {wRows: CountRows(MyGallery_1.AllItems)},
   UpdateContext(
      {
         varRows: "Count items: " & Text(wRows),
         IsNotFound: wRows = 0
      }
   )
)

then the Text of the Label would be

varRows

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

MVP (Business Applications)   Visit my blog Practical Power Apps

 

 

 

View solution in original post

5 REPLIES 5
Rusk
Responsive Resident
Responsive Resident

It looks like you are trying to update a variable in a text label?  Is that correct?  I don't think you can do that... what is it that you are trying to accomplish with your formula?

v-dezhili-msft
Microsoft
Microsoft

Hi @TimmyBoy ,

 

UpdateContext() is a behavior function and cannot be used in a label.

 

Best Regards,

Dezhi

Hi @Rusk ,

Well, i like to reset the IsNotFound value

To hide my other Group_HtmlText i have added above the Form1

Because when no data has been found this Group_HtmlText stays visible.

I even added this IsNotFound on visible of the Group_HtmlText

WarrenBelz
Super User
Super User

Hi @TimmyBoy ,

You cannot set UpdateContext in the Text of a Label - it needs to be a separate action - either that or do this on a button/icon

With(
   {wRows: CountRows(MyGallery_1.AllItems)},
   UpdateContext(
      {
         varRows: "Count items: " & Text(wRows),
         IsNotFound: wRows = 0
      }
   )
)

then the Text of the Label would be

varRows

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

MVP (Business Applications)   Visit my blog Practical Power Apps

 

 

 

Hello @WarrenBelz ,

Thank you.

Works like a charm 😉

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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