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

Community site session details

Session Id :
Power Apps - Error Handling
Answered

Syntax error when using Lookup() inside Patch()

(0) ShareShare
ReportReport
Posted on by 9
I am fairly new to Power Apps and have a basic understanding of coding. I have an Excel table as my data source. I have the following code:
 
Patch(
    Assessments_3,
    LookUp(
        Assessments_3,
        'CIA Document Number' = DocNum.Value
        ),
        {'CEP/CER Update Required?':UpdateReq.Value,
        'Rationale if "No"':Rationale.Value,
        'CEP/CER update fall outside of PMS schedule':UpdatePMS.Value,
        'Affected CEP/CER Document Numbers':ReportNumbers.Value,
        'Owner of CEP/CER Update':UpdateOwner.Value,
        'MasterControl Packet Numbers':PacketNumber.Value,
        'Approved and Released in MasterControl':ApproveRelease.Value
        }
    );
ResetForm(Form1)
 
The specific error I am receiving: "Error when trying to retrieve data from the network: Syntax error at position 12 in 'CIA Document Number eq 'DCE-03-TEST". inner exception: Syntax error at position 12 in 'CIA Document number eq 'DCE-03-TEST". clientRequestId: fe220978-0e0d-473b-99db-5169a395b8da.
 
I've done several troubleshooting - Copilot, Google searches - but haven't come across a good solution. Eventually I would like to have 2 conditions to check which means I may have to use Filter but if I can get this code with Lookup() to work then in theory, I can apply the same thing to Filter(). 
 
Additional Info:
* CIA Document Number is the official column header (includes spaces)
* DocNum is an input text control 
* I am using an = sign so unsure of why the error message states eq
* I've also checked my source file and the columns are "Text" for cell type. 
* I've also refreshed my data a few times. 
* Haven't been able debug the rest of the code because the lookup control isn't working. 
 
Main Pain Point: 'CIA Document Number' (column header, unsure of data type) = DocNum.Value (data type: text)
 
Please help! 
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    152,811 Most Valuable Professional on at
    Syntax error when using Lookup() inside Patch()
    Firstly, your actual code syntax is fundamentally correct
    Patch(
       Assessments_3,
       LookUp(
          Assessments_3,
          'CIA Document Number' = DocNum.Value
       ),
       {
          'CEP/CER Update Required?': UpdateReq.Value,
          'Rationale if "No"': Rationale.Value,
          'CEP/CER update fall outside of PMS schedule': UpdatePMS.Value,
          'Affected CEP/CER Document Numbers': ReportNumbers.Value,
          'Owner of CEP/CER Update': UpdateOwner.Value,
          'MasterControl Packet Numbers': PacketNumber.Value,
          'Approved and Released in MasterControl': ApproveRelease.Value
       }
    );
    ResetForm(Form1)
    However I will add that Excel is a terrible data source (switch to a SharePoint List if it is available to you) and has many things that "should work but do not".
    Remove any spaces and special characters from your field names and try again - suggestion below
    Patch(
       Assessments_3,
       LookUp(
          Assessments_3,
          'CIA_Document_Number' = DocNum.Value
       ),
       {
          CEP_CER_Update_Required: UpdateReq.Value,
          Rationale_if_No: Rationale.Value,
          CEP_CER_update_fall_outside_of_PMS_schedule: UpdatePMS.Value,
          Affected_CEP_CER_Document_Numbers: ReportNumbers.Value,
          Owner_of_CEP_CER_Update: UpdateOwner.Value,
          MasterControl_Packet_Numbers: PacketNumber.Value,
          Approved_and_Released_in_MasterControl: ApproveRelease.Value
       }
    );
    ResetForm(Form1)
     
    Please ✅ Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • PP-12112122-0 Profile Picture
    9 on at
    Syntax error when using Lookup() inside Patch()
    Hey WarrenBelz!
     
    Thank you so much for your quick response! To clarify, is SharePoint Lists the same as Microsoft Lists? If that is the case, then I migrated my Excel table into a Microsoft List. 
     
    Now. The formula works and I don't get any error messages. However, the row doesn't update with the content I am inputting into the text control. How do I address that?
  • WarrenBelz Profile Picture
    152,811 Most Valuable Professional on at
    Syntax error when using Lookup() inside Patch()
    Essentially the same in theory (Lists uses SharePoint for storage), however I have seen posts of some limitaitons (I do not use them, so cannot comment much). If you are able, create the List in SharePoint.
  • PP-12112122-0 Profile Picture
    9 on at
    Syntax error when using Lookup() inside Patch()
    Thank you! After your suggestion, I did some additional research and found out that Microsoft Lists replaced SharePoint Lists but both are essentially the same and stored in SharePoint. 
     
    Thank you again for your prompt response! I was able to get my app to work :) 
  • WarrenBelz Profile Picture
    152,811 Most Valuable Professional on at
    Syntax error when using Lookup() inside Patch()
    They did not replace SharePoint lists as such (SharepPoint is still very widely used), but are a different interface. Is your issue now solved ?
  • PP-12112122-0 Profile Picture
    9 on at
    Syntax error when using Lookup() inside Patch()
    Yes, my issue is now resolved, thank you!

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

Coming soon: forum hierarchy changes

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 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics