web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup Inside If State...
Power Apps
Unanswered

Lookup Inside If Statement inside Patch Function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I maybe about to lose my mind so hopefully you can help me.

 

I was trying to write a dynamic form.  The information was placed in a collection that looks like this:

 

CDB_Norsk_0-1681336203913.png

 

I was trying to pass data into a dataverse table using a patch function and building it piece by piece.

 

Initially I wrote the following:

 

LookUp(colFinal,crfa1_name="Machine Number").Data 

This returns "G4-33" as expected.

 

I nested this in an IF statement, which returned an unexpected false value.

 

IF(LookUp(colFinal,crfa1_name="Machine Number").Data="G4-33","Yes","No")

This returns "NO" for some reason.

 

I have no idea what I am doing wrong within the If statement that would cause it to return a negative given that the Lookup returns the same text as the comparison?

 

What am I missing?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,565 Most Valuable Professional on at

    Hi @Anonymous ,

    You are correct in your confusion (you should be based on your posted content). If your data looks like this

    WarrenBelz_1-1681337249194.png

    then you certainly should get a "Yes" response unless there is another record with the crfa_1_name as 'Machine Number' with a different value in the Data field.

    Try this (another "degree of separation"), but your original code certainly should work.

    With(
     {
     wData:
     LookUp(
     colFinal,
     crfa1_name = "Machine Number"
     ).Data
     },
     If(
     wData = "G4-33",
     "Yes",
     "No"
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I appreicate the resposne, but alas, it didn't work... and I am even more confused.

     

    So the lookup statement in the above still returned "G4-33" as expected.  Even then the If statement returned "NO" rather than "Yes".

     

    Not sure where to go with this, it looks like it should be simple...

  • WarrenBelz Profile Picture
    155,565 Most Valuable Professional on at

    @Anonymous ,

    Sorry, lost me as well - this is a bit left-field (and really something I avoid), but for debugging, put this on a Label

    LookUp(
     colFinal,
     crfa1_name = "Machine Number"
    ).Data

    then your Text

    If(
     YourLabelName.Text = "G4-33",
     "Yes",
     "No"
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard