web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dsiplay error label fo...
Power Apps
Answered

Dsiplay error label for each item in gallery

(0) ShareShare
ReportReport
Posted on by 135

Hi Team,

 

I am looking for displaying error in each item of gallery if in case text value of item is empty as button is placed for every specific item of gallery.

 

I have been trying with below formula on button OnSelect but it shows error for all items because TextInput2.Text refers to whole gallery. However, I am looking for getting error specific to an item of gallery.

 

 

If(
 IsBlank(TextInput2.Text),
 UpdateContext({showErrorLabel: true}),
 UpdateContext({showErrorLabel: false})
);

 

 

 

and ShowErrorLabel in error label visibility

 

 

I tried referring the TextInput2.Text with ThisItem but it doesn't accept that formula.

 

Here is the snapshot from my app..

 

PurpleDeveloper_0-1620320682256.png

On select of ConfirmWeight button if TextInput is empty, it shows error for all items. whereas I am looking to get the error only for the item whose button is selected.

 

Hope it make sense.

 

Appreciate any help on this!!!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @PurpleDeveloper 

    You are using a context variable to indicate the true or false nature of visibility for your label.  This context variable is in context of the entire screen.  So, once you set it to true, it will display all the labels...as you are seeing.

     

    PowerApps works best with referential formulas rather than behavioral formulas.  It is designed around Excel which uses formulas.

    Why do I mention that??  Because you are going about this rather "programmatically" with behavioral statements.

     

    You have a couple of options:

    1)  Have the label be visible if there is no weight entered.  Set the Visible property of the label to : 

    IsBlank(TextInput2.Text)

     

    2) If you have to have this on a row by row basis, then your approach should be this:

    In the OnSelect of the button, use this formula:  UpdateContext({errorRow: ThisItem.ID})

    Then on the label Visible property:

    (ThisItem.ID = errorRow) && IsBlank(TextInput2.Text)

     

    I hope this is helpful for you.

  • PurpleDeveloper Profile Picture
    135 on at

    Hi @RandyHayes,

     

    Thank you so much for quick turnaround and sharing the solution. It worked very well 🙂

     

    In addition to that, I was also resetting the TextInput so what happens here, as soon as I click the ConfirmWeight button even after the value inserted and stored in CDS, it shows the error label.

     

     

     

    UpdateContext({errorRow: ThisItem.ID});
    Reset(TextInput2);

     

     

    Any suggestion if I should use reset function somewhere else or to add if IsBlank(ThisItem.Weight) to check if value already present in database then not show the error message. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard