cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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.

Highlighted

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

Highlighted
Super User II
Super User II

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


Highlighted

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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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