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 / compare choice data us...
Power Apps
Answered

compare choice data using switch or if statement

(0) ShareShare
ReportReport
Posted on by 5

Is there any way to compare the choice type of dataverse?

 

for example

If(temptable.employeeType=employeeType.Company, Navigate(HomeScreen_Field);

 

or

 

Switch(temptable.email,
employeeType.Company, Navigate(HomeScreen_Field),
employeeType.Field, Navigate(HomeScreen_Desk),
Notify("default")
)

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @HaningYa :

    I suggest that you can first use the Text function to convert the value of the Choice field to a text type and then compare. I've made a test for your reference:

    1\My data source

    1.JPG

    2\The formula

    If(Text(First(BOFChoices).TheChoiceColumn)="Choice2",Navigate(Screen2))

    Best Regards,

    Bof

     

  • HaningYa Profile Picture
    5 on at

    thank you very much!
    I don't exactly know about First function in powerapps but problem solved.

  • Schwartz_Cory Profile Picture
    184 on at

    For those that are working in SharePoint Lists:

    Example: I am trying to filter visibility of column2,3,4 based on the selection of column1.

    In column1, don't need to do anything. just know the options are col2,col3,col4.

    In column2 in the visible field, you can use this formula:

     

    !IsBlank(Filter(column1.SelectedItems, Value = "col2"))

     

     What this code is doing is:

    1. (Filter(column1.SelectedItems, Value = "col2) = create a table where the selected items are col2
    2. !IsBlank = is that table NOT blank (does the table have anything in it?) If so, then show col2. Else hide col2.

     

     

    You would need to do this for the col3 and col4 as well. 

    You can also do this in the Required field of the datacard, like i did as well.

     

    Like if this helped you, and have a great day!

  • Schwartz_Cory Profile Picture
    184 on at

    I just noticed an issue with this code. When I load the app, the column1.selecteditems shows that there is data in there, even though it is empty. To fix this, change the code for the column2 visible to the following

    CountRows(Filter(col1.SelectedItems, Value = "col2"))>0

    Just another way to check for an empty table. 🙃

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 638

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard