cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calerof
Advocate II
Advocate II

Condition based on a lookup column from Dataverse from Teams

Hello,

I have a simple app in Dataverse for Teams that looks like this:

table0.png

 

It has two tables, second table called "Responsible" has two columns, name and responsible, and the first column called "Non Conforming Material Outputs" (Salidas No Conformes in Spanish) has a column of type Lookup referencing table 2.

Table 1Table 1Table 2Table 2

 

What I need is to make a condition for the column "Customer" (Cliente in Spanish) where if the Responsible selected is "Customer" then make that control required, else not.

 

I'm basing this small app on this great video from Reza Dorrani:

Build Power Apps in Microsoft Teams - Dataverse for Teams for Beginners

If I were to create a similar condition from Choice type column within the same table, Priority for example, then the code would be like this and works fine:

 

If(
    EditForm1.Mode = FormMode.New || ThisItem.Prioridad <> DataCardValue9.Selected.Value,
    Switch(
        DataCardValue9.Selected.Value,
        'Prioridad (Salida No Conformes)'.Alta,
        true,
        'Prioridad (Salida No Conformes)'.Media,
        false,
        'Prioridad (Salida No Conformes)'.Baja,
        false,
        false
    )
)

 

table1.png

 

But if I want to base this Requirement property on the Responsible column, the code just doesn't work, Datacardvalue25 doesn't show ".value" at the end:

table1.png

 

I'd appreciate your help.

Thanks,

Fernando

 

1 ACCEPTED SOLUTION

Accepted Solutions

@calerof 

Can you look at my screenshot above? Ive created similar example in my power app to show you that you dont have a "Choice" in DataCardValue25, you have a Record There, and you have to compare Column of that Record, to Column of your Record, 

In the first example you mentioned, you're Trying to compare Record to Value Of The Choice, (remember you cannot compare Record to Record in power apps, you have to choose column), look at screenshot from my Ap with explanation,

 

BR

Zbigniew

View solution in original post

6 REPLIES 6
Z_Lukowski
Resolver I
Resolver I

Hey @calerof ,

I would like to know what's the type of DataCardValue25, I think it's different than DataCardValue9, because you have Error on first line of your Code and Value is not recognized, mayby you have Text there?

If yes than replace DataCardValue25.Selected.Value with  Value(DataCardValue25.Selected.Text) because if you have text, you cannot compare it with Numbers, check the error on "<>" when you'll hover over it Error text will popup, can you copy it here? 

 

BR

Zbigniew

Hi @Z_Lukowski ,

Thanks for your reply.

This is the error in the <> operator and below the properties of Datavardvalue9 (Priority) and Datacardvalue25 (Responsible).

error1.pngerror2.pngerror3.png

Thanks!

F

 

@calerof 

Z_Lukowski_0-1633872235588.png

 

Hi @Z_Lukowski ,

Sorry I didn't get exactly your response, in the email is truncated:

"...LEFT SIDE <> LookUp(YourDataSourceTable, NameOfTheFieldInTableSameAsChoiceSelection = Text(NameOfYour"

I did this:

error1.png

My Responsible table structure is like this:

error0.png

Even if I omit the second condition and search for the actual value of the choice, I don't know how to do it:

 

error2.png

 

Thank you again.

F

 

@calerof 

Can you look at my screenshot above? Ive created similar example in my power app to show you that you dont have a "Choice" in DataCardValue25, you have a Record There, and you have to compare Column of that Record, to Column of your Record, 

In the first example you mentioned, you're Trying to compare Record to Value Of The Choice, (remember you cannot compare Record to Record in power apps, you have to choose column), look at screenshot from my Ap with explanation,

 

BR

Zbigniew

View solution in original post

Hi @Z_Lukowski ,

Thank you for the push to try to elaborate on my own this struggle, but yes you helped me and this is the solution to my problem, that looked back, it was easy:

If(
    EditForm1.Mode = FormMode.New || ThisItem.'Area Responsable'.Name <> 
    DataCardValue25.Selected.Name,
    Switch(
        DataCardValue25.Selected.Name,
        LookUp(Responsables, Name = "Cliente", Name),
        true,
        false
    )
)

 

Thanks!

Fernando

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,341)