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

Notifications

Announcements

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

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
    153,084 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
    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
    153,084 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard