cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ALP1
Super User
Super User

If statement - multiple conditons

Hi,

I have created a powerapps form from my SP list.

I have a dropdown with 2 values  - "Fiche de faisabilité" and "Fiche programme"

 

When i select Fiche de faisabilité, i can input the name of my client into the name field.

But if i select Fiche programme i want to filter it or lookup

 

This is my formula

If(dpd_etape.Selected.Value="Fiche de faisabilité";ThisItem.'Nom du client';Filter(dpd_recherche_etude.Selected.Nom);Nomduclient))

 

ALP1_0-1623254986954.png

To explain what is my purpose.

I created a document library. When I upload a document (excel for example) I fill in the requested metadata.

But when I load another document (Word for example), I must be able to associate it with the excel document I just uploaded

For quality reasons, I must be able to automatically retrieve the metadata that I have filled in for the excel document.

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User
Super User

@ALP1 

Please consider changing your Formula to the following:

If(dpd_etap.Selected.Value = "Fiche de faisabilité"; 
   ThisItem.'Nom du client';
   dpd_recherche_etud.Selected.Nom
)

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@ALP1 

It's a long video, but well worth the time!  And thanks for subscribing!!

 

So for your Items formula, you need to have matching schemas.

If(dpd_etape.Selected.Value="Fiche de faisabilité";
    Sort(Distinct('Base région centre';Region);Result);

    RenameColumns(
       Filter('centre de documentation';Région=dpd_recherche_etude.Selected.Région).Région;
       "Région"; "Result"
    )
)

 

The first part of your If is returning a table with a single column called Result.  In your formula, you had the second part returning a table with a table with a single column called Région.

In the above formula, both conditions will not return tables of compatible schemas.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

RandyHayes
Super User
Super User

@ALP1 

We'll get there!!

 

So for that dropdown, the real question is what is the Value property set to??

RandyHayes_0-1623456881140.png

 

But, in looking at your formula further for Centre concernée there are some issues with it

If(dpd_etape.Selected.Value="Fiche de faisabilité";
    RenameColumns(
       Sort(
           Filter('Base région centre'; 
               Colonne2=dpd_region_concernee.Selected.Result
           ).Colonne4; 
           Colonne4
       );
       "Colonne4"; "Centre"
    );

    RenameColumns(
        Filter('centre de documentation'; 
           'Centre concerné' = dpd_recherche_etude.Selected.'Centre concerné'
        ).'Centre concerné';
       "Centre_concerne"; "Centre"
    )
)

And the Value highlighted in the above image should be set to "Centre".

 

In your current formula the first If is returning a table with a column called Colonne4 and the else part of the If is returning a table with a single column called Centre

 

The column names need to match to get this to work.  With the above formula they will all be tables with single columns called Centre.  

Should work for you now.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

24 REPLIES 24
dyee
Resolver II
Resolver II

I think you want to be using the lookup function rather than the filter function.  I think the formula you want is something like...

 

If( Dropdown1.Selected.Value = "Fiche de faisabilité", "", Lookup(DataSource, LookUpColumn = LookupCondition,FieldYouWantReturned).

 

RandyHayes
Super User
Super User

@ALP1 

Please consider changing your Formula to the following:

If(dpd_etap.Selected.Value = "Fiche de faisabilité"; 
   ThisItem.'Nom du client';
   dpd_recherche_etud.Selected.Nom
)

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

YOU ARE AWESOME. Thank you so much

ALP1
Super User
Super User

Hi @RandyHayes , sorry to distrub you again.

Can you help me. I have a dropdown and my formula isn't working

 

If(dpd_etape.Selected.Value="Fiche de faisabilité";Sort(Distinct('Base région centre';Region);Result);Filter('centre de documentation';Région=dpd_recherche_etude.Selected.Région).Région)

 

ALP1_0-1623335376541.png

 

I searched for hours but I didn't find anything

 

Do you have an idea ? 

RandyHayes
Super User
Super User

@ALP1 

What property are you putting that formula in??

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

When i select fiche de faisabilité, the user must select the region in the dropdown list.

So if i use this formula it works

If(dpd_etape.Selected.Value="Fiche de faisabilité";Sort(Distinct('Base région centre';Region);Result)

 

But when the user selects "Program form", I want to fill the field with what was selected by the user.

I tried several formulas but to tell the truth I'm a little lost on this second part.

 

I tried with this -

If(dpd_etape.Selected.Value="Fiche de faisabilité";Sort(Distinct('Base région centre';Region);Result);'centre de documentation';ThisItem.Région=dpd_recherche_etude.Selected.Région).Result

RandyHayes
Super User
Super User

@ALP1 

You're mentioning the formulas, but I need to know what property of your Dropdown that you are trying to put this formula in.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
ALP1
Super User
Super User

Oh Sorry...it's items property.

By the way, i suscribe to your channel and i'm watching powerapps forms plus...it's fascinating. 

ALP1
Super User
Super User

ALP1_0-1623344134721.png

 

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,312)