Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

classic combobox DefaultSelectedItems

(1) ShareShare
ReportReport
Posted on by 6
I have a SP List "Locations" that has a field "AllInfo" that I use as a look-up list and another SP list "RecruitInfo" that has a text field "DutyLocation" that stores data from "Allinfo" field. I'm using a combo box (Single selection) to select from the many locations of the locations list, I have changed the combo box to multi selection.  I need separate the default  selected items property.
ForAll(
           Split(ThisItem.DutyLocation, "; "),
               LookUp(Locations, ThisRecord = AllInfo).AllInfo
)
The error that I'm getting is: Incompatible types of comparison These types can't be compared: Records , Text
 
  • Suggested answer
    CU21102350-0 Profile Picture
    6 on at
    classic combobox DefaultSelectedItems
    Thanks for your reply RacRig5407.
     
    I got it to work by setting the following properties on the combobox:
     
    DefaultSelectedItems =  Filter(Locations, AllInfo in Parent.Default)
     
    Datacard property Update = Concat(combobox.SelectedItems,AllInfo & "; ")
  • WarrenBelz Profile Picture
    146,605 Most Valuable Professional on at
    classic combobox DefaultSelectedItems
    OK - that is a whole new issue - what are you using to write back the data. I am assuming you want to append it to the existing data ?
  • CU21102350-0 Profile Picture
    6 on at
    classic combobox DefaultSelectedItems
    Hello Warren, 
    Thanks for your reply. I'm working with SP list text field (DutyLocation), in order to save values from a combobox you have to save as a text value i.e. Concat(Combobox.SelectedItems.Allinfo & "; ").
    To pull the data saved from the DutyLocation text field I can use {Value:ThisItem.DutyLocation}, all this works fine!
    However, this field needs to be edited and here is where the problem occurs.
    1) The combobox does display the correct information and user can select a new location but when saving it only sees the new selection not the existing selections.
    2) The data comes in as one concatenated string, If the data consists of two or more previous locations and the user wants to remove one of the selections it can't be done it removes all the data.
     
    This is the reason I need to split the data. Your help is truly appreciated, thank you in advance
  • RacRig5407 Profile Picture
    72 on at
    classic combobox DefaultSelectedItems
    I've been working with multi-select combos as People-Pickers lately, and here is how I'm getting an Edit form to display the previously saved values:

    If(IsBlank(Parent.Default), [], Filter(colTeamLeads, Email in Parent.Default))

    or another example for a single-select, where you can use = :

    If(

        IsBlank(Parent.Default),
        [],
        Filter(
            colBUGTMContacts,
            DisplayName = Parent.Default
        )
    )

    I'm using collections, but I think you could do the same with Locations.AllInfo. Hope this helps. If you're working with the DefaultSelectedItems property, I assume you're in an Edit form (not in New mode), right?  

    In my examples, I'm saving combobox values to SharePoint in Text fields. Then in the Edit form mode, this is how I'm getting the control to display back to me what was saved in SharePoint.

     
  • WarrenBelz Profile Picture
    146,605 Most Valuable Professional on at
    classic combobox DefaultSelectedItems
    I cannot see your data, so have simply looked at syntax here - try
    ForAll(
       Split(
          ThisItem.DutyLocation, 
          "; "
       ) As _Data,
       {
      Value:
      LookUp( Locations, _Data.Value = AllInfo ).AllInfo
    ​​​​​​​ } )
    however what I am unclear on here is that if you are after the AllInfo field value in Locations, where the AllInfo field equals the value in each delimited item in DutyLocation, why bother with the LookUp as you already have the value.
     
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     

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 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard