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

Gallery Filter

Hi 

 

I've a textbox and wanna filter a gallery with it.

My formula:

 

With({Controle:ControleDespesas; Enderecos: ENDERECOS};
Sort(
Filter(Controle;
Ano = Text(AnoEscolhido);
Despesa = DespesaEscolhida;
txtbusca.Text = Blank() Or RefIDEnd = LookUp(Enderecos;txtbusca.Text in Cidade).Idend || LookUp(Enderecos;txtbusca.Text in Endereco).Idend

);RefIDEnd;Ascending)
)

 

 

My screen:

 

alessandramaced_0-1639073791129.png

 

The textbox (txtbusca) and filter is not working for "Cidade" and "Endereco".

What I did wrong?

I've to filter "ControleDespesas" and textbox need to search in another sharepoint list named "ENDERECOS". The field of "IDEnd" from "ENDERECOS" is number and make reference to field "RefIDEnd" from "ControleDespesas".

In gallery the fields Cidade" and "Endereço" are lookup datas :

Endereço: LookUp(ENDERECOS;Idend=ThisItem.RefIDEnd).Endereco

Cidade: LookUp(ENDERECOS;Idend=ThisItem.RefIDEnd).Cidade

 

My sharepoint lists are as bellow:

ENDERECOS:

alessandramaced_1-1639074132882.png

 

 

ControleDepesas:

alessandramaced_2-1639074161727.png

 

 

RefIDEnd = IDEnd

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
alessandramaced
Helper V
Helper V

I got it.

Delete textsearchbox , put a dropbox instead wtih all "Endereco" (address).

And change gallery filter formulta to:

With(
{Controle:ControleDespesas; Enderecos: ENDERECOS};
Sort(
Filter(Controle;
Ano = Text(AnoEscolhido);
Despesa = DespesaEscolhida;
dpdFiltroEnd.Selected.Endereco = Blank() Or RefIDEnd = LookUp(Enderecos;Endereco = dpdFiltroEnd.Selected.Endereco).Idend
);
RefIDEnd;Ascending)
)

 

 

Now it's working.

Thank you

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @alessandramaced ,

Try the below - you need to refer to the field value in each LookUp and also bracket your and/or areas

With(
   {
      Controle:ControleDespesas; 
      Enderecos: ENDERECOS
   };
   Sort(
      Filter(
         Controle;
         Ano = Text(AnoEscolhido) &&
         Despesa = DespesaEscolhida &&
         (
            txtbusca.Text = Blank() ||
            RefIDEnd = LookUp(
               Enderecos;
               txtbusca.Text in Cidade
            ).Idend || 
            RefIDEnd = LookUp(
               Enderecos;
               txtbusca.Text in Endereco
            ).Idend
         )
      );
      RefIDEnd
   )
)

 

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.

Visit my blog Practical Power Apps

not working, know shows nothing in gallery

 

I think the problem is that I can't use lookup, because can exist more than one record with same "Cidade" or part of Address ("Endereco").

Is that possible to filter gallery like this?

@alessandramaced ,

That does not really help me - unless I can understand what it is you are trying to do, I can only rely on the code you posted and try to make it valid syntax  I assume the code is not producing errors?

alessandramaced
Helper V
Helper V

I got it.

Delete textsearchbox , put a dropbox instead wtih all "Endereco" (address).

And change gallery filter formulta to:

With(
{Controle:ControleDespesas; Enderecos: ENDERECOS};
Sort(
Filter(Controle;
Ano = Text(AnoEscolhido);
Despesa = DespesaEscolhida;
dpdFiltroEnd.Selected.Endereco = Blank() Or RefIDEnd = LookUp(Enderecos;Endereco = dpdFiltroEnd.Selected.Endereco).Idend
);
RefIDEnd;Ascending)
)

 

 

Now it's working.

Thank you

 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,353)