cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chris_Watts
Frequent Visitor

Collection not collecting?

Hi All,

 

I'm trying to add some offline capability to my QR Code scanner app, as it will be used in areas where mobile reception is flaky.  The code seems to be fine syntactically, as Powerapps doesn't show a formula error, but neither the gallery control I added to view the collection, nor browsing to Collections in the File menu show anything (although the latter does have the column headings:

If(Connection.Connected, Patch(Attendees, {'Supplier Name':qrstring,Event:Dropdown1.SelectedText.Value, Guests:Slider1.Value});Reset(Slider1);
Navigate(Screen1, ScreenTransition.Cover),
Collect( offlineoutput, {'Supplier Name': qrstring, Event: Dropdown1.SelectedText.Value, Guests:Slider1.Value});
Navigate(Screen3, ScreenTransition.Fade))

 

What am I missing? 

5 REPLIES 5
KranthiTupakula
Responsive Resident
Responsive Resident

Did you try clearcollect instead of collect?

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/offline-apps

___

If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Hi, yes I had it as ClearCollect originally - have just tried again and it behaves the same way, not writing anything to the collection.

iAm_ManCat
Super User
Super User

Hi,

 

Your formula states that it will only collect if Connection.connected=false, which means there needs to be no internet connection available in any form when you test it (airplane mode on phone will work for this) - you can't test this from the editor as you're online when using the editor.

 

If(
    Connection.Connected,
    
    // True condition
    Patch(Attendees,
          {
             'Supplier Name':qrstring,
             Event:Dropdown1.SelectedText.Value,
             Guests:Slider1.Value
          }
    );Reset(Slider1);
    Navigate(Screen1, ScreenTransition.Cover),

    // false condition
    // will only trigger if there is no internet connection
    Collect(offlineoutput,
            {
               'Supplier Name': qrstring,
               Event: Dropdown1.SelectedText.Value,
               Guests:Slider1.Value
            }
    );
    Navigate(Screen3, ScreenTransition.Fade)
)

 

Could you try testing this on a mobile device that's on airplane mode (maybe have a screen where the collection is displayed in a gallery so that you can confirm?),

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Hey Sancho, that's exactly how I've been testing it actually - scanning a qr code while connected to make sure the connection.connected=true condition is working, and then putting my mobile into flight mode and scanning again to test the false condition.

 

The patch to sharepoint list works as expected, just not the collection. Apologies for not being clearer! 😊

Had a quick skim through Matt Schuesler's presentationon offline apps and I think collecting when offline is a no-go, seems more like you collect when online, and then use saveData, and when offline you use loadData

 

here's the full article if you want a nice primer on offline Apps:

https://jobs.collab365.community/powerapps-offline-disconnected-mode/

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,215)