cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
McMonty
Resolver I
Resolver I

CDS choice field in Power Apps

Hi,

I have this CDS choice column [Timesheets.'Timesheet Stage'] with 3 options (Open, Pending, Approved).

I'm trying to do something like this: 

If(Timesheets.'Timesheet Stage' = "Open",Color.Blue, Color.Red)

I just can figure out how you can read the choice in the column. I can easily display the choice text in a label by setting it to Timesheets.'Timesheet Stage'.

 

What am I doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @McMonty 

With CDS/Dataverse, the field name for a choice column provides an enumeration of acceptable choice items. Therefore, you should be able to express your formula with syntax that looks like this:

If(Timesheets.'Timesheet Stage' = 'Timesheet Stage'.Open,
   Color.Blue, 
   Color.Red
)

View solution in original post

2 REPLIES 2
timl
Super User
Super User

Hi @McMonty 

With CDS/Dataverse, the field name for a choice column provides an enumeration of acceptable choice items. Therefore, you should be able to express your formula with syntax that looks like this:

If(Timesheets.'Timesheet Stage' = 'Timesheet Stage'.Open,
   Color.Blue, 
   Color.Red
)

View solution in original post

Hi, 

Thanks, it turned out to be the name of the choice.

McMonty_0-1613917656985.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,133)