cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Dual Super User
Dual 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
Highlighted
Dual Super User
Dual 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!
Highlighted
Helper I
Helper I

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

Deleting this because the above solution is FAR more efficient!

Highlighted
Dual Super User
Dual 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!

Highlighted
Helper I
Helper I

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})))

 

 

Highlighted
Frequent Visitor

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);
					{
						Procedimiento:Dropdown1.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

Highlighted
Dual Super User
Dual 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!
Highlighted
Frequent Visitor

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).

Highlighted
Dual Super User
Dual 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

Highlighted
Frequent Visitor

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

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