cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
NickAdams1975
Level: Powered On

Problem creating a basic collection

All I am trying to do is follow the beginners tutorial document called,

 

"Author a basic formula that uses tables and records in a PowerApps canvas app"

 

I just want to step through this little test and create a collection as a formula.

 

So in 'Screen 1' of a the most basic canvas I enter:

 

Collect(collectMyFirstCollection, {Name: "Jeff", FavoriteColor:"Blue"}, {Name: "Chewy", FavoriteColor: "Red"})

 

This seems to create collectMyFirstCollection 

 

But when I 'View Collections' in PowerApp, whilst the field headings are there, there are no records. Thus I cannot even run a simple formula on (for example) the most simple Text object and give it a title of "Blue" from the collection.

 

I am obviously missing something basic and fundamental. Could someone help please?

 

Many thanks,

 

Nick

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Problem creating a basic collection

Your formula is correct.  But where are you entereing the formula?  Add a button to Screen 1 and put the formula in the onSelect method of the button.  Then when you run your app you can press the button to create your collection.  You could also put it in the OnStart method of the app itself.  When you run the app it will create the collection.

 

I would however suggest in this case that you use ClearCollect instead of Collect.  Each time you run Collect it will add the records specified to the collection.  ClearCollect deletes the collection first. To update existing records in a collection use Patch



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: Problem creating a basic collection

Hi @NickAdams1975 

 

I guess you are seeing this issue because you have put the function to collect this collection on "OnVisible" property of your screen, and while we are in edit mode, the "onscreen" doesn't get executed when we play the app. This will work if you set a navigation from one screen to other, so when you are getting navigated, the "On Visible" will get executed.
 
As a workaround, you can use a temporary button and put the formula on "OnSelect" property while testing your app and create the collection through it. This is a simple edit mode restriction.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
4 REPLIES 4
Super User
Super User

Re: Problem creating a basic collection

Your formula is correct.  But where are you entereing the formula?  Add a button to Screen 1 and put the formula in the onSelect method of the button.  Then when you run your app you can press the button to create your collection.  You could also put it in the OnStart method of the app itself.  When you run the app it will create the collection.

 

I would however suggest in this case that you use ClearCollect instead of Collect.  Each time you run Collect it will add the records specified to the collection.  ClearCollect deletes the collection first. To update existing records in a collection use Patch



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: Problem creating a basic collection

Hi @NickAdams1975 

 

I guess you are seeing this issue because you have put the function to collect this collection on "OnVisible" property of your screen, and while we are in edit mode, the "onscreen" doesn't get executed when we play the app. This will work if you set a navigation from one screen to other, so when you are getting navigated, the "On Visible" will get executed.
 
As a workaround, you can use a temporary button and put the formula on "OnSelect" property while testing your app and create the collection through it. This is a simple edit mode restriction.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
NickAdams1975
Level: Powered On

Re: Problem creating a basic collection

I think I understand my issue. I thinkthe formulas are correct but I am not understanding how to save and refresh the app appropriately.

 

So when I closed the web browser and came back to it all it worked.

 

I don't understand this though as my App preview will not work and holding down the ALT key will not work until I save the close down the browser.

 

Do you have any tips on the process I should follow to make my app work. I assumed that it would work as soon as I entered formulas but it doesn't on mine!

 

Thanks,

 

Nick

Super User
Super User

Re: Problem creating a basic collection

Hi @NickAdams1975 

 

You can put the code on App control and select the property "OnStart", this will create the collection once whenever you app is started.
MicrosoftTeams-image (131).png

Hope this Helps

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 304 members 4,263 guests
Please welcome our newest community members: