cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

ForAll in Patch Question

Hello, 

I'm using a new pattern for Form building and could use some help on a ForAll function.

Goal: 

- To Concatenate items in colSelectedResponses Collection which have the same ID and Patch them to the data source.

- Example: The two items below where id = 2 need to be concatenated and Patched to the data source as "Hammer; Ball Peen"

Scenario:

- Variable created from a table of data

Set(
    varItems,
        Table(
            {id: 1, item: "Wrench"},
            {id: 2, item: "Hammer"},
            {id: 2, item: "Ball Peen"},
            {id: 3, item: "Screwdriver"}
        )
)

- Gallery with Checkbox controls. Items Property set to varItems

- OnCheck of Checkbox

Collect(
    colSelectedResponses,
        {
            id: ThisItem.id,
            value: component_checkbox.Text
        }
)

- Button to Patch values has OnSelect Property set to:

Patch(dataSource,
    Defaults(dataSource),
    {
        dataSourceColumn1: LookUp(colSelectedResponses, id = 1, value),
        dataSourceColumn2: 
                ForAll(
                    Filter(colSelectedResponses, id = 2),
                    Concatenate(value, ";")
                ),
        dataSourceColumn3: LookUp(colSelectedResponses, id = 3, value),
    }
)

- The ForAll is not correct syntax. 

Any help is appreciated!
Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: ForAll in Patch Question

Figured it out with some help from @KickingApps!

Concat(Filter(colSelectedResponses, id = 31), value, "; ")

Yay!

View solution in original post

2 REPLIES 2
Super User
Super User

Re: ForAll in Patch Question

Anyone want to take a stab at this one? Its kind of holding me up right now... ugh!

Highlighted
Super User
Super User

Re: ForAll in Patch Question

Figured it out with some help from @KickingApps!

Concat(Filter(colSelectedResponses, id = 31), value, "; ")

Yay!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,025)