cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Charlyvil
Level: Powered On

Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hi friends. I'm starting and motivated with powerapps few days ago Smiley Very Happy but now I'm stuck:

 

I have a Dropdown(Items):

 

Distinct(Sort(colListaProcedimientos;nListaProcedimineto);nListaProcedimineto)

And a ComboBox(Items) with multiple select:

 

 

Puestos.Puesto

I got that values from another lists and I want to insert in another List('Procedimientos') but I don't want duplicated records. 

 

 

So for example:

List('Procedimientos'):

colA    _|_ colB

hello         world

hello         daddy

 

Insert: hello(from dropDown), world,Jenny(from comboBox)

 

Would be fail for world but for Jenny would be pass:

colA    _|_ colB

hello         world

hello         daddy

hello         Jenny

 

I'm trying this but don't works:

Set(item;First(Filter(Procedimientos;Procedimiento in comboBoxPuestos.SelectedItems.Puesto;nombrePuesto in Dropdown1.Selected.Result)));;
Patch(Procedimientos;item;{Procedimiento: Dropdown1.Selected.Result; nombrePuesto: comboBoxPuestos.Selected.Puesto})

Smiley Sad

 

Any ideas are welcome.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hi @Charlyvil 

 

If you can create a lookup column to Puestos list in the Procedimientos list. This will make the relationship management much easier. Also, you have a option to allow mutliple selections, that way it could be done easily and properly.
 
Regarding displaying the value from the list, this can be done by using controls that supports table schema such as Gallery, Combobox controls etc. In case, you want to show a string value of all the selected options, then you can use the Concat() function to display the results.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

11 REPLIES 11
Super User
Super User

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hi @Charlyvil 

 

To achieve this, you can create the expression as:
 
ForAll(
    ComboBox1.SelectedItems;
    If(
        CountRows(
            Filter(
                Procedimientos;
                ColB = Puesto && ColA = Dropdown1.Selected.Value
            )
        ) = 0;
        Patch(
            Procedimientos;
            Defaults(Procedimientos);
            {
                ColA: Dropdown1.Selected.Value;
                ColB: Puesto
            }
        )
    )
)
 
Here, Puesto is the name of combobox column.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hooze
Level: Powered On

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Deleting this because the above solution is FAR more efficient!

Super User
Super User

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hey @Charlyvil 

 

Were you able to resolve? 

 

Hey @Hooze 

 

Thank you for the comment, but I believe you should not have deleted your suggestion (it could give another perspective for everyone here to approach a problem-solution). 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hooze
Level: Powered On

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

@yashag2255 

 

I suppose that is true.

 

Here is the solution I'd thought up, which I hope may be a helpful method or avenue of thought in other situations.

 

ClearCollect(DupCheck, AddColumns('Procedimientos', "DupFormat", Concatenate(Text(ColA),Text(ColB))));

Forall(ComboBox1.SelectedItems
     If(Not(Concatenate(Text(Dropdown1.Selected.Value),Text(Puesto)) in DupCheck.DupFormat),

Collect('Procedimientos', {ColA: Dropdown1.Selected.Value, ColB: Puesto})))

 

 

Charlyvil
Level: Powered On

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hi and thanks for your solutions. I adapt the formula but don't works Smiley Sad :

ForAll(comboBoxPuestos.SelectedItems;
    If(
		CountRows(
					Filter(
							Procedimientos;
							nombrePuesto = Puesto && Procedimiento = 
                                                         Dropdown1.Selected.Result
							)
						)=0;
					Patch(Procedimientos;
					Defaults(Procedimientos);
					{
						ProcedimientoSmiley Very Happyropdown1.Selected.Result;
						nombrePuesto: Puesto
					}
					)
		)
)

But I got duplicates sometimes and I don't know why:2019-09-16 22_08_18-Window.png

It's more frecuent in multiple selection.

I appreciate any contribution. Smiley Very Happy

Super User
Super User

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hi @Charlyvil 

 

Can you try to update your expression as:
 
ForAll(comboBoxPuestos.SelectedItems;
    If(
        CountRows(
                    Filter(
                            Procedimientos;
                            nombrePuesto = Puesto && Procedimiento =
                                                         Dropdown1.Selected.Result
                            )
                        )=0;
                    Patch(Procedimientos;
                    Defaults(Procedimientos);
                    {
                        ProcedimientoSmiley Very Happyropdown1.Selected.Result;
                        nombrePuesto: Puesto
                    }
                    );;Refresh(Procedimientos)
        )
)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Charlyvil
Level: Powered On

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

I'm still having repetitions Smiley Frustrated. Your solution looks good, but I don't know what happen.

Do you have another recomendation to save the data. I only want the relation of two tables. (I was thinking on only one table and one cell have multiple values and then in powerapps split the information, but don't know if it's possible).

Super User
Super User

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

Hi @Charlyvil 

 

If you can create a lookup column to Puestos list in the Procedimientos list. This will make the relationship management much easier. Also, you have a option to allow mutliple selections, that way it could be done easily and properly.
 
Regarding displaying the value from the list, this can be done by using controls that supports table schema such as Gallery, Combobox controls etc. In case, you want to show a string value of all the selected options, then you can use the Concat() function to display the results.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Charlyvil
Level: Powered On

Re: Insert into SP list from ComboBox(multiselect) and Dropdown without repetitions

I did all that you say. I have a little issue: I want search in a lookup value with múltiple values(displaying as a list). Some idea?

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 77 members 3,735 guests
Please welcome our newest community members: