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 / Dropdown default blank...
Power Apps
Unanswered

Dropdown default blank at new record and compiled when edit it

(0) ShareShare
ReportReport
Posted on by 8

Hi all,

I try to found a solution for my problem in the forum and other source but nothing. Probably is my fault.

 

My problem is easy. Canvas app, excel on onedrive. I have only one question in my app, that requires a dropdown with 3 options: "" (blank), "Yes", "No".

 

I need that when user want to insert the new record (+ button of the standard canvas app), the dropdown has the blank value as default. Differently, when the user try to edit the record selected, the dropdown will start with the record value as default. I have attached one image to explain better what i mean.

 

Thanks for you patience and understanding.

 

Thanks and best regards.

 

Alberto

Categories:
I have the same question (0)
  • yuxi666 Profile Picture
    Microsoft Employee on at

    Hi @Spatatons 

     

    If my understand is correct, you want the app do  as this:

    when you click "+", the dropdown shows default as blank, when you click "Edit",it shows the value the last time you choose.

    Please follow the next steps (the colored ones you can change in your App):

    1.Icon New: NewForm(EditForm1);Navigate(BrowseScreen1, ScreenTransition.None);ClearCollect(test,{Name:" "})

    2.Icon Edit: EditForm(EditForm1);Navigate(BrowseScreen1, ScreenTransition.None);ClearCollect(test,{Name:" "},{Name:"YES"},{Name:"NO"})

     

    Best Regards.

    yuxi

     

  • Spatatons Profile Picture
    8 on at

    Dear Yuxi,

    Thanks for your reply. Unfortunately i haven't understand how to configure the field with the dropdown (the field of item available, update, default, etc..). Is possible to have an example of one application with that system applied?

     

    Thanks in advance.

    Regards.

    Alberto

  • Slaverty Profile Picture
    218 on at

    I think Yuxi maybe hasn't understood your requirements, or I haven't.  How I would go about implementing what you want is like this.

     

    Create one variable, this will be for your record.  I'll call it varCurrentRecord.

    Create another for the form mode, I'll call it varFormMode

    Then, your two buttons (add and edit), we'll call AddBtn and EditBtn.

     

    On your EditBtn,

    create the record variable (eg UpdateContext({varCurrentRecord: Parent.Selected}))

    Create the mode variable (UpdateContext({varFormMode: "Edit"})

    Followed by "EditForm(yourform)"

     

    Then, on the AddBtn,

    Create the mode variable (UpdateContext({varFormMode: "New"})

    Followed by "NewForm(yourform)"

     

    Then, on the drop down inside "Default Selected Items" you would have something like

     

    If( varFormMode = "Edit", varCurrentRecord.Choice)

     

    I've assumed your selections are coming from a gallery here.  Also, you could probably reference some of the items directly rather than having to create variables, depending on your structure.

  • Spatatons Profile Picture
    8 on at

    Dear Slaverty,

    For the button "Modify" in "DetailScreen":

    I follow your indication, but change the update context  UpdateContext({varCurrentRecord: Parent.Selected})  into  UpdateContext({varCurrentRecord: DataCardValue1.Text})  because Parent.Selected generate a syntax error. I thought that varCurrentRecord must be a general variable that must contains the actual value visible on the field.

     

    For the button "Add" in "BrowseScreen":

    I follow your indication.

     

    The problem is in the "EditScreen": is not possible, in the default property of the dropdown to recall the other variable varCurrentRecord or varFormMode.

     

    And as last request, if i have 10 dropdown field to manage, i must set and recall 10 different variables, and i think it become long to write and read. It's very strange that we must use these tricks to solve the problem, and is not expected that one application requires a blank dropdown for new form and the compiled for the edit.

     

    I'm blocked to develop my application due to this 😭.

     

    Thanks for the help..

     

    Alberto

  • Spatatons Profile Picture
    8 on at

    Solved with the previous suggest!

     

    It's enough to set to 1 a global var when press the new form button, and to set to 0 the same global var when press the edit form button.

     

    In default property, use if ( global_var = 1 , "" , thisitem.columnrecord );

     

    Thanks for the support!

     

    Alberto

  • Slaverty Profile Picture
    218 on at
    Nice, glad you got it working. A wee tidbit if you're using variables like that, you can use true and false instead of 0 and 1 for shorter formulas.
    So your default property would become
    if ( global_var, "" , thisitem.columnrecord )
    Or
    if ( !global_var, thisitem.columnrecord ) ('default property' will default to blank if no match)
    Or
    if ( var_Edit, thisitem.columnrecord )
    global_var/var_Edit would itself be the true or false statement.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard