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 / COLLECT: Writing extra...
Power Apps
Unanswered

COLLECT: Writing extra records

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm not sure how, but each write to my Data Source (Sharepoint) is creating a blank record along with the actual records. Maybe you can see where I'm messing up here: 
Use Case:

  • Offline-capable app (my first!) for simple equipment measurements
  • Offline capabilities are not implemented yet.
  • OnStart, a hardcoded EquipmentCollection is created of all possible Equipment/Widget combinations (only 😎
  • Using a Form control for Error Handling and other things (don't ask 🙂 ), but NOT using SubmitForm()
  • Some of the choices require multiple iterations through the Form (tricky)
    • Example of tricky-ness:
      • User selects "Equipment 12" from Equipment Name dropdown
      • The Widget Name dropdown now shows two separate Widgets to inspect for that particular piece of Equipment.
      • Both Widgets require the exact SAME measurements to be captured in the Form

Scenarios

  • If Equipment has only 1 Widget (requires 1x Form)
    • User clicks Submit
    • Collection is created of all Form fields (RecordCollection)
    • If CountRows of EquipmentCollection = CountRows of ReadingCollection, 
// Show the user that the Widget measurement is "Completed"

Update(EquipmentCollection,
 First(
 Filter(EquipmentCollection, 
 equip = EquipmentName.Selected.Value
 And widget = WidgetName.Selected.Value
 )
 ),{equip: EquipmentName.Selected.Value, widget: WidgetName.Selected.Value & "-COMPLETED"}
 );

// Write the RecordCollection back to the Sharepoint List as a new record

 Collect(SharepointListName,
 Defaults(SharepointListName),
 RecordCollection
  • If Equipment has 2 Widgets (requires 2x Form)
    • User clicks Submit
    • Collection is created of all Form fields (RecordCollection)
    • If CountRows of EquipmentCollection <> CountRows of ReadingCollection,
      • Notify() User that Widget2 needs to be measured
      • Reset() Form fields
      • Widget1 shows as "Completed" in the dropdown
    • User completes measurement of Widget2
    • User clicks Submit
    • Same code as above runs
// Show the user that the Widget measurement is "Completed"

Update(EquipmentCollection,
 First(
 Filter(EquipmentCollection, 
 equip = EquipmentName.Selected.Value
 And widget = WidgetName.Selected.Value
 )
 ),{equip: EquipmentName.Selected.Value, widget: WidgetName.Selected.Value & "-COMPLETED"}
 );

// Write the RecordCollection back to the Sharepoint List as a new record

 Collect(SharepointListName,
 Defaults(SharepointListName),
 RecordCollection

Ha! Feel a little funny writing this all up with no screenshots. Hopefully its clear. 

The results is the correct data being written to the Sharepoint List WITH a blank record as well. There is a blank row between every record (whether a single Widget record or 2 Widget record).

 

 

Categories:
  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @ericonline

    To diagnose this a bit further, could you somehow view RecordCollection before you Collect it, just to confirm that it contains the data that you expect (without any blank rows)?
    Perhaps you could do this by viewing File > Collections, or by storing it in another variable that you can inspect afterwards.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi there @timl. Thank you for the response. The collections do not show blank records when working in the IDE.

    I think I figured it out... It seems to be happening on mobile only. Looks like it might stem from the SaveData() LoadData() logic. I think the app is loading the saved file (collection) with a blank record in it, then adding this to the Patch.

    I'll investigate a bit more and let you know what I find.

    Take care!

     

     

  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @ericonline

    I'm glad you're making progress on this. If you want a quick fix to this, I suppose you could Filter the RecordCollection in your call to Collect to remove any blank rows.

    I'd be interested to see what you find following your investigations.

    Have a nice weekend and take care too Eric!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Baffler! I updated the logic as follows thinking it would clear the mystery blank record in "offlineCollection":

    • If Connected = true
      • Patch data source with values
      • Clear(offlineCollection)
      • SaveData(offlineCollection,"offlineCollection")

    I'm going to try your Filter() trick next. Thanks @timl!

  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @ericonline

    That is very strange, especially how you get black rows between each record that you collect!

    Hopefully, the Filter trick will fix this problem but it would be interesting to understand the cause.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for your help with this thread @timl

     

    @ericonline - have you made any progress with this issue?

     

    @Anonymous

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous, not yet. Too many irons in the fire! This one might have to wait till 2019 🙂 Vacay approacheth!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard