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

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


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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (49,267)