cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slhangen
Helper V
Helper V

Displaying Values of ListBox in Gallery

Need verbiage to display all selected values of listbox populating collection.  Using collection (colIndicators) because it is a multi-screen form.

OnSelect of Next Screen button is:

 

ClearCollect(colIndicators,
{
colRiskFactorsPersonality:lbRiskFactorsPersonality.SelectedItems.Value,
colGoalsPersonality:lbGoalsPersonality.SelectedItems.Value,
colInterventionsPersonality:lbInterventionsPersonality.SelectedItems.Value,
colRiskFactorsMentalHealth:lbRiskFactorsMentalHealth.SelectedItems.Value,
colGoalsMentalHealth:lbRiskFactorsMentalHealth.SelectedItems.Value,
colInterventionsMentalHealth:lbRiskFactorsMentalHealth.SelectedItems.Value
}
)

 

I can get first value with:

Concat(colIndicators, First(colGoalsMentalHealth).Value, ",")

 

How can I get all selections of each colIndicator item?

 

Thx so much!

1 ACCEPTED SOLUTION

Accepted Solutions

@slhangen 

Yes...I gave you the formula for it:

ClearCollect(colIndicators,
    {
        colRiskFactorsPersonality: Concat(lbRiskFactorsPersonality.SelectedItems, Value & ","),
        colGoalsPersonality: Concat(lbGoalsPersonality.SelectedItems, Value & ","),
        colInterventionsPersonality: Concat(lbInterventionsPersonality.SelectedItems, Value & ","),
        colRiskFactorsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems, Value & ","),
        colGoalsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems.Value, Value & ","),
        colInterventionsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems, Value & ","),
    }
)

 

This will give you a collection with one record with 6 columns.  Each column will be a comma separated string of the selected items in the corresponding ListBox controls.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

5 REPLIES 5
RandyHayes
Super User III
Super User III

@slhangen 

I am not entirely sure if you are asking that you want to display all of the items of a particular columns (i.e. colRiskFactorsPersonality) as a comma separated list or if you want to get this in some other way.

 

If in a comma separated list, you could consider altering your Formula to the following:

ClearCollect(colIndicators,
    {
        colRiskFactorsPersonality: Concat(lbRiskFactorsPersonality.SelectedItems, Value & ","),
        colGoalsPersonality: Concat(lbGoalsPersonality.SelectedItems, Value & ","),
        colInterventionsPersonality: Concat(lbInterventionsPersonality.SelectedItems, Value & ","),
        colRiskFactorsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems, Value & ","),
        colGoalsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems.Value, Value & ","),
        colInterventionsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems, Value & ","),
    }
)

Note, you are assigning a single record to a collection.  You can also assign this to a lower-weight variable or even simply use the concat function in your Gallery.

 

But again, not sure exactly where you're trying to go with it.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

I just want to display any choices that are selected.  Can be up to 5 per section.

Don't know the verbiage for Concat to get all the items, only the first.

@slhangen 

Yes...I gave you the formula for it:

ClearCollect(colIndicators,
    {
        colRiskFactorsPersonality: Concat(lbRiskFactorsPersonality.SelectedItems, Value & ","),
        colGoalsPersonality: Concat(lbGoalsPersonality.SelectedItems, Value & ","),
        colInterventionsPersonality: Concat(lbInterventionsPersonality.SelectedItems, Value & ","),
        colRiskFactorsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems, Value & ","),
        colGoalsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems.Value, Value & ","),
        colInterventionsMentalHealth: Concat(lbRiskFactorsMentalHealth.SelectedItems, Value & ","),
    }
)

 

This will give you a collection with one record with 6 columns.  Each column will be a comma separated string of the selected items in the corresponding ListBox controls.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Now I see, thanks so much

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,382)