cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kervin
Resolver I
Resolver I

... If multiple ???

Bonjour,

Je viens (encore) avec une bête question

Je dois filtrer une galerie sur base base de la valeur d'une variable (Var1)

 

J'ai écris ceci :

if(var1="0";

    Filter(.....)  <=== Il m'indique une faute ici 
if(var1="1";

    Filter(.....);

If(var1="3";

    Filter(.....);

...

If(var1="5";

    Filter(.....)

 

Quelqu'un peut-il m'aider ? Merci pour votre aide

1 ACCEPTED SOLUTION

Accepted Solutions

bonjour v-xida-msft et mdevaney,

 

 

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@Kervin 
I suggest you use a SWITCH function instead.  If there is still an error please take a screenshot of the error message and post it to the forums.

 

Switch(var1;
    "0"; Filter(.....);
    "1"; Filter(.....);
    "3"; Filter(.....);
    "5"; Filter(.....)
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

v-xida-msft
Community Support
Community Support

Hi @Kervin ,

Could you please share more details about the error message within your Filter function?

 

Please consider take a try to modify your formula as below:

Filter(
       'Your Data Source';
       If(
          var1 = "0";
          FilteredColumn = var1;        // Type proper filter condition for var1="0" here
          var1 = "1";
          FilteredColumn2 = var1;       // Type proper filter condition for var1="1" here
          var1 = "3";
          FilteredColumn3 = var1;       // Type proper filter condition for var1="3" here
          ...
          ...
       )
)

 

In addition, I also agree with @mdevaney 's thought almost. You could achieve your needs using Switch function instead of If function:

Switch(
       var1;
       "0"; Filter(....);
       "1"; Filter(....);
       "3"; Filter(....);
       ...
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-xida-msft 

An honest question: if the idea I supplied is already good why bother to COPY + PASTE what I wrote into your own post? 🙄   Its simply enough to acknowledge my good work and carry on 😎

bonjour v-xida-msft et mdevaney,

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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