Skip to main content

Notifications

Community site session details

Community site session details

Session Id : xT8MIFzJFcnIBD+k0kqWSJ
Copilot Studio - General
Answered

How can I reference choice variables using Power fx?

Like (0) ShareShare
ReportReport
Posted on 16 Feb 2023 15:46:34 by 10

I have a bot topic that at some point, needs to set a variable based on a choice the user has made in a previous part of the flow.

 

The problem is, the Choice field is not recognised as a same comparable type as Text, so my formula isn't working. I've had this issue before using Power fx with Power Apps, and I know that there is a way to reference the choice itself, rather than a text value, but there appears to be no "Choices" function built into the PVA side of things. Does anyone know how I reference the Choice correctly?

 

Here's a sample of the code not working below:

 

 

If(Topic.selectedColor = "Blue", true, false)

 

 

 

The error I'm receiving is:

Incompatible types for comparison. These types can't be compared: OptionSetValue(cr559_bot.topic.colorpickerflow.main.question_Ckz917), Text

 

Thanks

  • benshikari Profile Picture
    10 on 16 Feb 2023 at 21:09:47
    Re: How can I reference choice variables using Power fx?

    Fantastic, thanks @HenryJammes - I'm not sure why I didn't even think about casting as Text but I'm glad it works and you pointed it out! Thanks again.

  • Verified answer
    HenryJammes Profile Picture
    on 16 Feb 2023 at 19:11:19
    Re: How can I reference choice variables using Power fx?

    Can you try by changing the format of your variable to text?

     

    If(Text(Topic.selectedColor) = "Blue", true, false)

     

    Also, not sure if it helps, but I had explored dynamic options in that post, and I manipulated these in Power Fx too:

    Solved: Re: How can I use Dynamic Multi-choices in the PVA... - Power Platform Community (microsoft.com) 

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Copilot Studio - General

#1
Pablo Roldan Profile Picture

Pablo Roldan 25

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 23

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard
Loading started