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 / Patch Network Error. P...
Power Apps
Unanswered

Patch Network Error. Possibly just syntax?

(0) ShareShare
ReportReport
Posted on by 374

Hello, I posted this earlier and marked it as resolved, however it's actually not working, "Network error", Field "KeyColumn" is required.

 

ForAll(
 GalleryNewSchedule.AllItems,
 Patch(
 MyTable,
 If(
 IsBlank(
 LookUp(
 MyTable,
 KeyColumn = NameIndexTextBox
 )
 ),
 Defaults(MyTable),
 {
 KeyColumn: NameIndexTextBox,
 Area: Area,
 ScheduleDate: DateValue(ScheduleDate),
 Name: Name,
 Job: Job,
 DateTimeRecordAdded: Now(),
 Shift: Shift,
 JobAbbr: JobAbbr,
 CreatedByUser: User().Email 
 }
 )
 )
)
;

 

 

Oddly, it will update a record if the name I have selected is already in the SQL table, but when I choose a name that isn't in there yet it does not work. 

Categories:
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @kariseightytwo ,

    I am not an SQL user, but try this structure (which would work in SharePoint)

    Patch(
     MyTable,
     ForAll(
     Filter(
     GalleryNewSchedule.AllItems,
     IsBlank(
     LookUp(
     MyTable,
     KeyColumn = NameIndexTextBox
     ).KeyColumn
     ) &&
     !IsBlank(NameIndexTextBox)
     ) As aPatch,
     {
     KeyColumn: aPatch.NameIndexTextBox,
     Area: aPatch.Area,
     ScheduleDate: DateValue(aPatch.ScheduleDate),
     Name: aPatch.Name,
     Job: aPatch.Job,
     DateTimeRecordAdded: Now(),
     Shift: aPatch.Shift,
     JobAbbr: aPatch.JobAbbr,
     CreatedByUser: User().Email 
     }
     )
    )

    If an item is not in the gallery, remove the aPatch reference.

     

    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.

    Visit my blog Practical Power Apps

  • kariseightytwo Profile Picture
    374 on at

    Thank you so much for your response. Unfortunately I'm getting an error: 
    "Network error when using Patch function: The specified record was not found."

    Seems as if it can't find the value in the keycolumn. Shouldn't be able to though because it's a new record at this point.. any thoughts?

  • kariseightytwo Profile Picture
    374 on at

    Instead of patching directly from the gallery, I have the data in a collection, which I'd like to use. 

    Can you make this look up the record first and update, or create new if needed?:

     

    ForAll(forCastdates,Patch(MyTable,
    Defaults(MyTable),
    {
     KeyColumn: NameIndexTextBox,
     Area: Area,
     ScheduleDate: DateValue(ScheduleDate),
     Name: Name,
     Job: Job,
     DateTimeRecordAdded: Now(),
     Shift: Shift,
     JobAbbr: JobAbbr,
     CreatedByUser: User().Email 
    }));
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @kariseightytwo ,
    As I noted, I am not an SQL user (in Power Apps - used a lot in Access some time ago), but what you have posted should work (albeit a bit slower as you are "looping" patches). Normally an Insert command in SQL does not need the Key Column, so I am a bit puzzled why it does not work. This post may be useful.

  • kariseightytwo Profile Picture
    374 on at

    Well, I certainly appreciate your help! Thank you for the link, too. I'll take a look.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard