Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Get values of combo box in a gallery

(0) ShareShare
ReportReport
Posted on by 559

Hi All,

I have a gallery called Phases which display values based on the Project name selected and it has a combo box (Combobox6) which filter the respective value based on the Phase displayed in the Phase gallery and a check box. 

The items of the Phase gallery is : Distinct(Phasenames,Phase) which loads the Phases for each Project selected. 

The check box of the Phase gallery is: Set(contR,0);Set(contR,Sum(CountRows(ComboBox6.SelectedItems),contR)); which counts the number of items in the combo box. 

The items property of the Combo box : Filter(Work_ Product_ Master, PhaseNames = Title2.Text).'Work Product/Process' which filter the values based on the Phase displayed is the Phase gallery. 

when checkbox is clicked in the first Phase gallery it will add rows in the below gallery collecting the Phase and Work Product from the Phase gallery. 

The code on the + icon is: ForAll(Sequence(contR),Collect(colFinalPhase,{ID: Last(colFinalPhase).ID + 1,
'Project Name': prjnames_3.Selected.ProjectName,
Phase: Title2.Text}));

when the + icon is clicked row has to be added in the second gallery which should the display the value of Phase and Work Product by default in the second gallery. Phase is getting displayed in the second gallery when row is getting added. For the Work Product If the Phase is selected as Design which shows 3 items in the combo box those three items should get displayed in the second gallery (in three rows).. Each row one combo box item should be displayed. If the Phase has only one item one row will be displayed.

 

Any help/suggestion on this would be greatly appreciated.

Thanks in advance.

Categories:
  • Sri Profile Picture
    559 on at
    Re: Get values of combo box in a gallery

    @v-mengmli-msft 

    Thanks a lot. It worked perfectly.

  • v-mengmli-msft Profile Picture
    on at
    Re: Get values of combo box in a gallery

    Hi @Uthhra ,

     

    Usage template for the lookup function: LookUp(DataSource,condition)

    The default value for the drop-down option should be obtained from the Items of the drop-down control. In other words, whatever selection you want to get, drop-down control items must have this choice.

     

    For example:

    We have set the Items of Combo box like this:

    vmengmlimsft_0-1697104744110.png

    vmengmlimsft_2-1697104885435.png

     

    Now we need to set the default of it:

    vmengmlimsft_1-1697104835612.png

    So that's why I'm asking you how your drop-down control's Items is set up.

     

    Hope this helps you!

    -----------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

  • Sri Profile Picture
    559 on at
    Re: Get values of combo box in a gallery

    @v-mengmli-msft 

    What should be given in the Default selected items of the second gallery. If I give LookUp(ComboBox6_2.SelectedItems, Value = ThisItem.'Work Product/Process') getting an error stating Value is not recognized. ComboBox6_2.SelectedItems(first gallery combo box) ComboBox5_2.SelectedItems (second gallery combo box)

  • Verified answer
    v-mengmli-msft Profile Picture
    on at
    Re: Get values of combo box in a gallery

    Hi @Uthhra ,

     

    It seems that you took the original solution and did not use the checkbox's oncheck property to complete the method of adding records, but this method is actually simpler, in the current way you need to create another Collection to collect the records in the gallery with a checkbox value of true and use foralll function to add them to the data source in the gallery below.

     

    If you could accept the method of using checkbox add records, your current problem is relatively simple.

    Please try this:

    Set the OnCheck of Check box:

    ForAll(ComboBoxInAboveGallery.SelectedItems As C,Collect(colFinalPhase,{ID: Last(colFinalPhase).ID + 1,Phase: Title2.Text,'Work Product/Process':C.Value}))

     

     

    If the Items of 'Work Product/Process' Combo box looks like this:

    Distinct(DataSource,'Work Product/Process')

     

     

    Set the DefaultSelectedItems of 'Work Product/Process':

    LookUp(theItemsOfThisComboBox,Value=ThisItem.'Work Product/Process')

     

     

     

     

     

    Hope this helps you!

    -----------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

     

     

  • Sri Profile Picture
    559 on at
    Re: Get values of combo box in a gallery

    @FLMike 

    The items of the Phase gallery is : < Distinct

    (Phasenames

    ,Phase) > which loads the Phases for each Project selected. 

    The check box of the Phase gallery is: < Set(contR,0);

    Set(contR,

    Sum(CountRows(ComboBox6.SelectedItems),contR));

    > which counts the number of items in the combo box. 

    The items property of the Combo box : < Filter(Work_ Product_ Master,

    PhaseNames = Title2.Text).'Work Product/Process' > which filter the values based on the Phase displayed is the Phase gallery. 

    when checkbox is clicked in the first Phase gallery it will add rows in the below gallery collecting the Phase and Work Product from the Phase gallery. 

    The code on the + icon is: < ForAll(Sequence(contR),

    Collect(colFinalPhase,

    {

    ID: Last(colFinalPhase).ID + 1,
    'Project Name': prjnames_3.Selected.ProjectName,
    Phase: Title2.Text}

    )); >

     

    I hope it is clear now

  • Michael E. Gernaey Profile Picture
    41,317 Super User 2025 Season 1 on at
    Re: Get values of combo box in a gallery

    Hi @Uthhra 

     

    I truly want to help, I know many do, but we read hundreds and thousands of these. Please use carriage returns. Please put code in </> snippets


    If you like my answer, I would really appreciate if you please Mark it as Resolved, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

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,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard