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 / ComboBox - DefaultSele...
Power Apps
Answered

ComboBox - DefaultSelectedItems - But differentiate between New & Edit form

(0) ShareShare
ReportReport
Posted on by 46

I THINK I have set up correctly. Combobox is populating the necessary fields. I have set up MULTIPLE different DefaultSelectedItems options with differing levels of success.

I have used for DefaultselectedItems

Filter(Accounts,ACCOUNT_NAME2 = Account_Name2.Text)

Usually, I have the same editform1 for New or Edit and in Default I use something like 

If(EditForm1.mode = FormMode.New, “  “, ThisItem.XXXXXX)

 

But with Combobox and DefaultSelectedItems.... I don't seem to have the chance of differencing between New and Edit. 

 

I cant watch another yourtube trying to see a solution. Help please!

 

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mikemaccarthy 

    Can you clarify what you mean by "I have the same editform1 for New or Edit and in Default I use something like"

    What is Default?  Are you referring to the DefaultSelectedItems?

     

    Your formula on the DefaultSelectedItems should be: Coalesce(Parent.Default, Filter(Accounts, ACCOUNT_NAME2 = Account_Name2.Text))

     

    I hope this is helpful for you.

  • mikemaccarthy Profile Picture
    46 on at

    Hi Randy, Thanks for replying. Apologies for not responding quicker. Operating in European time.

    I did not explain myself well. So confused, going around in circles.

    Comboboxes and DefaultSelectedItems... and nothing in Default.

    My Power App has 3 screens, Browse, Details and Edit. No additional Galleries.

    If I enter data into the Edit form. All Seems Well. If I go to Browse, Review and Edit, All my data is there properly. Super. Do edits and Sumbit and all is perfect. Now instead of Editing, I hit the "New Button" which I hope brings me to a New Blank Edit Form... The last selected Account_Name2 is populated in the Combo Box. I have to delete this and then search. Workable, but does not inspire confidence.  Hence, I was hoping I could insert some formula like - If(EditForm1.mode = FormMode.New, “  “, ThisItem.XXXXXX) but this does not seem to work.

    Help.

    Your extra formula with the Coalesce(Parent.Default,   ) was causing an Error - The function 'Coalesce' has some invalid arguments. 

    Sorry.

    Thanks.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mikemaccarthy 

    No, the formula you tried will not work especially since you are providing a text value in New mode and when not, you are discarding the value of the Parent.Default.

    So we need to get your Coalesce statement working properly.

    Let's review a couple things:

    1) The underlying column of your datacard - what kind of column is it - text, choice, lookup, etc?  And if it is choice or lookup, is it defined to be a single or multiple?

    2) What is the Items property of your Combobox?

    3) And while we're putting the questions out - what is your Default and Update property for the Datacard?

  • mikemaccarthy Profile Picture
    46 on at

    Thanks.

    Underlying Column is -  Text   (Name of Accounts / clients - Sharepoint List)

    Item Property - Accounts

    Datacard - Default = blank / nothing    Update property = ComboBox1.Selected.ACCOUNT_NAME2

     

    Thanks

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mikemaccarthy 

    Okay...we're almost there.

    Set your DataCard Default property back to the original : ThisItem.'Name of Accounts / clients'  (I assume that is the column name from your list)

    Set the DefaultSelectedItems property of the combobox1 to:

        LookUp(Accounts, ACCOUNT_NAME2 = Coalesce(Parent.Default, Account_Name2.Text))

    The Update property of the datacard is fine.

     

     

  • mikemaccarthy Profile Picture
    46 on at

    I was praying as I typed......

    It seems Ok ....

    But...

    When you edit a .... not sure of the correct term.... Record from the browse screen and bring you to Edit form... and all seems fine and you can Edit and save etc.

    But now you want to creat a NEW record, so on teh browse screen hit the "+" sign goes to Edit Screen.... Empty Page..... EXCEPT the ComboBox is populated with teh name of the last record we were working on. Then need to go to Combo and Delete the last entry and then type in a search.

    Dohhhhh!!!!

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mikemaccarthy 

    Is Account_Name2 IN your form?  I had assumed so, but it sounds like perhaps it is not.

  • mikemaccarthy Profile Picture
    46 on at

    Thanks for your time.

    I will keep digging.

    M

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mikemaccarthy 

    Did we solve something???  

    Is that control in your Form or outside of it?  If it is outside and you don't wish to include it in the New record creation, then you can also use the form mode in that formula:

        If(!(EditForm1.Mode = New), LookUp(Accounts, ACCOUNT_NAME2 = Coalesce(Parent.Default, Account_Name2.Text))

  • Verified answer
    mikemaccarthy Profile Picture
    46 on at

    Randy,

    Gold Star!

    If(!(EditForm1.Mode = New), LookUp(Accounts, ACCOUNT_NAME2 = Coalesce(Parent.Default, Account_Name2.Text)) ...... Sorted it.

    I really have no idea how you fixed. I will have to read up now what " If(! " means of does.

    Thanks for your help.

    M

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard