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 / if code with toogle
Power Apps
Answered

if code with toogle

(0) ShareShare
ReportReport
Posted on by 176

how to write the code:

if toggle = false  : dropdown value = 0 if not display value of dropdown : Choices ([@ 'Customer account']. Name_x0020_du_x0020_r_x00e9_seau)

zz.png

Categories:
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    What is the name of the Choices dropdown?

  • Ben-00-38 Profile Picture
    176 on at

    the name of the choices dropdown is

    Choices ([@ 'Customer account']. Name_x0020_du_x0020_r_x00e9_seau) she correspond to the DataCardValue14.

    zzz.png

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Is 0 one of the choices in the dropdown and is it a dropdown or a combobox?

  • Ben-00-38 Profile Picture
    176 on at

    is a dropdown

    999.png

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Try this:  If(DataCardValue24 = false, DataCardValue14 = "0", Parent.Default)

  • Ben-00-38 Profile Picture
    176 on at

    I try the code but there is no value on dropdown...

     

     

     

    zzz.png

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Ok, if click on the Red X, it should take you to your formula and have some red lines.  If you hover over it there should be an error message, if you can share that and translate the message for me that would be helpful.

  • Ben-00-38 Profile Picture
    176 on at

    the message is

    the function IF contains invalid elements

     

    zzz.png

     

    with my code :

    zzz.png

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I am sorry, I gave you the wrong formula, if your dropdown is in a DataCard, then you will need to do this:

     

    If(DataCardValue24 = false, DataCardValue14 = "0", DataCardValueX.Selected.Value) 

     

    Replace X with the correct DataCardValue

     

     

     

     

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Is the formula on DataCardValue14?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard