cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Duplicate value on change visible

 

Hi,

 

For the following app the first box is a text input, the second one is a ComboBox. The idea is that at typing the box becomes visible and they select one person and get some info. Currently OnChange the following is done: 

Collect(Lista,{Nombre:ComboBox1.Selected.Title,Referencias:ComboBox1.Selected.Referenciascon,Unidad:ComboBox1.Selected.UnidaddeNegocio,LinkedIn:ComboBox1.Selected.LinkedIn,UsuarioEmail:User().Email,UsuarioNombre:User().FullName});ForAll(Lista, Patch('Busquedas realizadas', Defaults('Busquedas realizadas'), {Title: Nombre,UsuarioEmail: UsuarioEmail, UsuarioNombre: UsuarioNombre}));Reset(ComboBox1);Reset(TextInput2)

 

Right now is writing to the sharepoint list but I think is duplicating the value for the visible change. I would like it to just write once.

 

Thanks in advance

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Advocate III
Advocate III

Re: Duplicate value on change visible

Try using ClearCollect() instead of the Collect() function.  That will empty collection before setting new value.

 

Your ForAll() will fire for every item in your collection, so if there are 2 items, it will run two times.

 

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Duplicate value on change visible

@dhernandez ,

Just use ClearCollect on the first item

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
Highlighted
Community Champion
Community Champion

Re: Duplicate value on change visible

Hi @dhernandez ,

The below code resets ComboBox1 and TextInput2

Collect(
   Lista, 
   {
      Nombre:ComboBox1.Selected.Title,
      Referencias:ComboBox1.Selected.Referenciascon,
      Unidad:ComboBox1.Selected.UnidaddeNegocio,
      LinkedIn:ComboBox1.Selected.LinkedIn,
      UsuarioEmail:User().Email,
      UsuarioNombre:User().FullName
   }
);
ForAll(
   Lista, 
   Patch(
      'Busquedas realizadas', 
      Defaults('Busquedas realizadas'), 
      {
         Title: Nombre,
         UsuarioEmail: UsuarioEmail, 
         UsuarioNombre: UsuarioNombre
       }
   )
);
Reset(ComboBox1);
Reset(TextInput2)

Are you wanting ComboBox1 to become visible as soon as something is typed in TextInput2?
Put this on the Visible property of ComboBox1

Len(TextInput2.Text)>0

You can set this to a higher number if required, but ComboBox1 will appear as soon as the limit is reached.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted
New Member

Re: Duplicate value on change visible

Hi @WarrenBelz,

Yes that's working fine, the issue is that when resetting it sends twice to my SharePoint list the collection Lista. Is there a way to just sent it once.

Thanks


Highlighted
Advocate III
Advocate III

Re: Duplicate value on change visible

Try using ClearCollect() instead of the Collect() function.  That will empty collection before setting new value.

 

Your ForAll() will fire for every item in your collection, so if there are 2 items, it will run two times.

 

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Duplicate value on change visible

@dhernandez ,

Just use ClearCollect on the first item

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

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!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,347)