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
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,592)