cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pcakhilnadh
Helper V
Helper V

How to add a new row to table data type in Component.

  • I have a componenet named "MyComponenet"
  • I have an input property in that componenet of type table named "MyUsers". Which has only one field named "username"
  • I have initialized this input property with 3 values.
  • Now, I wanted to add a new row to this table type using a button click.
  • Since I wanted the solution in componenet Collect(), Patch() are not working as the first argument expected is a collection.

How can I add a new row to Input Property of Component of Table data type inside component?

 

Note:

I am looking for solutions using components only.

7 REPLIES 7
RandyHayes
Super User
Super User

@pcakhilnadh 

I would recommend doing this outside of the component as you'll not be able to use a collection inside of it.  

You could do it in the component with a variable, but I'd still recommend doing it outside of the component based on the press of the button inside the component.

 

To expand on this, I'd need to know a little more about the definition of your input property of the component.  What is the formula you have for that property in the component?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 
Could you elaborate on your solution by using variables?

I understand your recommendation. I am still looking for a solution with component only.

RandyHayes
Super User
Super User

@pcakhilnadh 

I could, but I'm a little confused on your Input property definition - you mentioned "...of type table named "MyUsers".

I am not sure what you mean by that as a table does not have a name.  Is that the name of the Property??

 

Perhaps if you have a screenshot, that might help me to understand your scenario as I'd like to provide a precise solution for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes  Yes, It is the name of the input property.

RandyHayes
Super User
Super User

@pcakhilnadh 

Okay, that is helpful...

Now, in your original post you mention: "Now, I wanted to add a new row to this table type using a button click."

Where is the table being used that you want the new row in it?

 

Are you ONLY adding one row ever in the component, or are you trying to do some sort of "table builder" component where a user might enter something in a textinput, then press a button, then enter more and press a button, etc.?

I am not clear on your component design or purpose, so could you expand on that?  Perhaps a screenshot of what you're trying to do would help as well.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes  by "table type" im referring to the table data type. It is referring to the same Input Property "MyUsers". I wanted to add a new row to this same table and show it in a gallery control.

RandyHayes
Super User
Super User

@pcakhilnadh 

Okay, I am still not understanding your purpose - and this is VERY important to providing some guidance.

 

I understand you have a MyUsers property and you have a Gallery in the component where you are displaying those record from that property.  But, what is the intention of adding a record (and how) and very importantly, is this just one record to add, or are you trying to add more than one?

 

This is all important information that I need to know because components are very different than apps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,350)