Power Apps - Create a collection

I have 4 labels defined like this,

Cat10
Cat21
Cat32
Cat45

and I have 4 corresponding text inputs defined as,

TextInput 10  (Takes only a number)
TextInput 21  (Takes only a number)
TextInput 32  (Takes only a number)
TextInput 45  (Takes only a number)

The User manually inputs the TextInputs and I want to do a bar graph of these numbers against the corresponding category while he is entering. How do I go about it. I did some research it says creating a collection is the only way. But couldn't solve it on my own. Kindly help me with this.

For example my collection will have 4 rows,

Category    Value
Cat10       10
Cat21       12
Cat32       21
Cat45       30

The number of rows will not increase, every time the user changes a value it will always update the existing one.

Upvotes: 1

Views: 3825

Answers (1)

Sascha Dornig
Sascha Dornig

Reputation: 48

The ClearCollect function should cover your need.

With the information you offered please try the below-listed formula

ClearCollect(
CustomCollection,
{
    Category: "Cat10",
    Value: TextInput10.Text
},
{
    Category: "Cat12",
    Value: TextInput12.Text
},
{
    Category: "Cat21",
    Value: TextInput21.Text
},
{
    Category: "Cat45",
    Value: TextInput45.Text
})

CustomCollection is the name of the collection you would like to store. So, you can, of course, go for a different name!

You can find more information about the ClearCollect function on the official Microsoft help page. Click here

Upvotes: 2

Related Questions