Embedded Canvas Apps

Challenge #4: Collecting a collection on the 1st screen

Challenge #4

Collecting items in a collection is a very common use case, and is often times done on the first screen of the app so the collection can be used throughout the rest of the app. However, if this is being done on the OnStart of the app or on the OnVisible property of the first screen, the collection remains empty. To test this out, add the following formula in the OnStart of the app or on the OnVisible property of the first screen of your app and also add a label that shows the count of records in the collection (for validation) and set the Items property of a gallery to the collection.

ClearCollect(conColl, [@ModelDrivenFormIntegration].Item.Contacts)

Collecting items on OnStart of the app (click to enlarge)

Trick #4

If items need to be collected on the first screen and cannot be put off until any subsequent screen, then the collection process should start on some kind of a trigger. A couple of examples of triggers are:

  • OnClick of a button (although not very desirable from a usability perspective)
  • OnTimerStart or OnTimerEnd of a timer control

I have used the button option to illustrate this trick.

Collecting items on a trigger (click to enlarge)

Have fun! Get addicted!

1 thought on “Challenge #4: Collecting a collection on the 1st screen”

Leave a Reply