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 / Conditional Requiremen...
Power Apps
Answered

Conditional Requirement based on Gallery Value/Form Viewer

(0) ShareShare
ReportReport
Posted on by 52

Hello, 

 

I have a page in which an approver can see the individual's entry on a gallery/form viewer. They have an accept or decline and a comments field. Based on one of the fields in the form viewer, I would like the comments field to be required. The type the Datacardvalue 16_1 is a combo box. 

 

I have tried several variations of 

If((DataCardValue16_1.SelectedItems= "Convenience", true, false))

If((DataCardValue16_1.Text= "Convenience", true, false))

If((DataCardValue16_1.Selected.Value= "Convenience", true, false))

 

 

I can't seem to get it down to having no errors. I keep running into an incompatible types for comparison error. Any ideas? Thinking it must be the format of the .select .text, etc. As I have several other If statements in the app but when referring to the info in the form viewer, it isn't seeming to work. Any help is appreciated!!

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @kayakingaway,

     

    Could you try the following code in the Required property of the Comments DataCard:

     

    DataCardValue16_1.Selected.Value = "Convenience"

     

    You can get the selected Choice by using comboboxName.Selected. If you want to compare it to text, you will have to add .Value at the end as well. An if statement in this case is not needed since the code above will have true or false as an output. However, If() statements only require 1 pair of brackets - your last if statement was the correct one (combobox value wise) and should look as follows:

     

    If(DataCardValue16_1.Selected.Value = "Convenience", true, false)

     

    As said, if statements that have true or false as a response are redundant and can be left out.

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

     

  • kayakingaway Profile Picture
    52 on at

    Thank you, thank you! This worked Perfectly.

     

    DataCardValue16_1.Selected.Value = "Convenience"

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard