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

Auto create unique collection names in PowerApps?

I am hoping to find if I can iterate the process of auto-creating unique collection names (for instance -Collect1,Collect2,Collect3...) based on the number of times a button is clicked in PowerApps. To elaborate in detail, I will explain the working of the app through screenshots from my current app (shown below) to demonstrate what happens in every screen and ultimately showing where I am struggling with.

Working of the app:

Plan Customisation  - Under the 'Plans' Tab, a Mobile Plan is selected from a Gallery and a'Handset' is selected from the 'dropdown box'. The selected items are added to two different collections namely
1. 'CollectMobilePlan1'
2. 'CollectHandset1'

 

Plan Customisation Screen.JPGPlan Customization Screen

Following a similar process, other selected items ( Accessory Repayment Option $360, Valued Customer Bonus) are added to two different collections namely

3. 'CollectAddOns1'

4. 'CollectDiscounts1' 

All of the selected four collections along with the total cost of the selected items are displayed in a Gallery as shown below in the 'Plan Summary Screen'

Customize Screen.JPGPlan Summary Screen


What I am hoping to achieve is to add a button called 'Add More Products' and when the user clicks this button, the whole process mentioned above (Plan Customisation - CollectPlan, CollectHandset, CollectAddOns, CollectDiscounts) should begin again. What I am struggling is with how to go about coding PowerApps to collect a different set of collections (i.e. CollectPlan2, CollectHandset2, CollectAddOns2, CollectDiscounts2) when the user hits the 'Add More Products' button.  The third time when the user hits the 'Add More Products' button, a third set of collections should be created(CollectPlan3,CollectHandset3,CollectAddOns3, CollectDiscounts3) and the whole processs should repeat and so on. The end result should be along the lines of how it appears below.
(I have just copied the same information twice for illustrative purposes)

Multiproduct selection.JPGMultiproduct selections

I am a beginner in PowerApps so any directions to achieve the same would be of immense help as I have been struggling to find a solution for the same. 

1 REPLY 1
Mike8
Level 10

Re: Auto create unique collection names in PowerApps?

Hello iamsujith,

I like the design of your app Smiley Happy

You can not auto-create unique collection names (for instance -Collect1,Collect2,Collect3...) based on the number of times a button is clicked in PowerApps. 
What you can do is add records in a collection that every record may have a field that identifies the specific record.
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-tables

So instead of creating collections (-Collect1,Collect2,Collect3...) you can add records to a collection and each record can have a different ID. ID is a column name.
So the moment you want to display certain records you can you Filter(CollectionName,ID=1) for example.
The above may seem too easy or too difficult to implement. What I am trying to say is that instead of creating collections with different names as you said, you can create records in a collection that each record (or set of records) has something unique to distinguish it from the other records (or set of records)