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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Display text/image in ...
Power Apps
Unanswered

Display text/image in gallery based on value of column(s) of a row

(0) ShareShare
ReportReport
Posted on by
Hello,
I'm a very newbie with PowerApps.
I'm trying to build an app as a way to learn Power Apps.
In the app, these has a screen with a gallery that retrieve data from Dataverse.
Now I want to add text/image next to each row in the gallery that will display based on condition of current row.
I know that can I can set the visible/invisible at "Visible" property of that text/image item which can return true or false based on an IF condition.
I was successful in setting the IF condition based on the value of a column using IsBlank function on ThisItem.<ColumnName>
But I wonder is there a way to get the value of a column of the current record and put it in the IF condition?
 
For example, what IF condition I need to USE to make text item display "HIGH" for current record if data of the current record matched 3 below conditions?
(1) <Price> column of the current record has value greater than "5000" and
(2) <ImportFlg> column (a Yes/No column in Dataverse) has set value as "Yes"
(3) <Status> column (a choice column in Dataverse) of the current record has set value as "LOWINCOME"
 
Could someone give me so advices? Thanks so much.
 
P/S: I tried searching for solution and found the article below but so regret that it doesn't shown detailedly how the questioner solved the problem
Categories:
I have the same question (0)
  • ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at

    Set Default Values

    To change the default value for any column in the edit form, you need to update the property that defines the default value in the control that is used to edit that property. You’ll also only want to define that default value for new items – if the form is editing an existing item, the form should display the current value for that column. You can do that with the If function, checking for the Mode property of the edit form control. For example, if you want to define the default value for a numeric column to zero, you can change the Default property of the text input control in the form from:

    Parent.Default
    to
    If(EditForm1.Mode = FormMode.New, 0, Parent.Default)
     
     
     
     
    You would use ThisItem. then the name of the field in the If statement in your case
  • ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    The complete explanation including choice columns
     

    Set Default Values

    To change the default value for any column in the edit form, you need to update the property that defines the default value in the control that is used to edit that property. You’ll also only want to define that default value for new items – if the form is editing an existing item, the form should display the current value for that column. You can do that with the If function, checking for the Mode property of the edit form control. For example, if you want to define the default value for a numeric column to zero, you can change the Default property of the text input control in the form from:

    Parent.Default
    to
    If(EditForm1.Mode = FormMode.New, 0, Parent.Default)
    Unlike “simple” controls like the text input or the date picker that have a single default value, the combo box control has a different way of defining its default values, so, the default expression needs to be defined appropriately. The combo box control is used in Choice, Lookup and Person column types – and since those types have the option of single and multiple selection, the default expression will change accordingly.

    Choice columns are those where the user can select from a pre-defined list of values. For example, if you have a column called ‘TimeOfDay’, we could have the list of [‘Morning’, ‘Afternoon’, ‘Evening’ and ‘Night’] as possible values – that’s a typical single-selection scenario. Or if you have a list that stores kitchen products, a column called ‘Intended Uses’ with possible values [‘Day-to-day’, ‘Formal dining’, ‘Gifts’, ‘Other’] would be a scenario where multiple selections are acceptable. In forms choice columns are mapped to the combo box control – which uses the DefaultSelectedItems property to determine the default values – and the value of this property can be both a single item (for the case of single selection columns) or a table (for the case of multiple selection scenarios).

    While choice columns on the surface look like a text column with certain restriction, they are implemented in SharePoint as an object, that references the list of possibilities for that column. If you tried to define the default property as follows:

    If(
        EditForm1.Mode = FormMode.New,
        "Morning",
        Parent.Default)
    It would give an error. Instead, you need to define it as a record with a property called Value, and that would define ‘Morning’ as the default value for that card when the card is in the New mode:

    If(
        EditForm1.Mode = FormMode.New,
        { Value: "Morning" },
        Parent.Default)
    For columns that support multiple selections, you need to use a table (collection) of data instead. So if you want to define the that ‘Day-to-day’ and ‘Gifts’ are the default values for the ‘Intended Uses’ column, we would use the following expression:

    If(
        EditForm1.Mode = FormMode.New,
        Table({ Value: "Day-to-day" }, { Value: "Gifts" }),
        Parent.Default)

    Those are columns for which the user can select a value from another table. This time, using the value only is not enough – it’s possible that there are multiple items in the table that is being looked up that have the same value for the referenced column, so we also need to specify the Id property of those values. The best way to retrieve it is to use the Choices function, which returns both the referenced column in the lookup, as well as the identifier of the value. So if you have a column named ‘Department’ of type lookup to another list ‘Departments’, and we know that the value that you want to use as the default is ‘Sales’, we can use a LookUp function if the column only allows single selection:

    If(
        EditForm1.Mode = FormMode.New,
        LookUp(
            Choices(MyListName.Department),
            Value = "Sales"),
        Parent.Default)
    Likewise, if the column supports multiple selection, then you’d use a Filter expression on the possible choices to define the default selected values:

    If(
        EditForm1.Mode = FormMode.New,
        Filter(
            Choices(MyListName.RelatedDepartments),
            Value = "Sales" Or Value = "Human Resources"),
        Parent.Default)
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard