Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How do I add rows to a table based on the amount entered in another field?

barbaras9901921
Level 1
Level 1

How do I add rows to a table based on an amount entered in another field instead of using an 'Add Row' button?

3 Replies
MinusZero
Level 7
Level 7

It isnt difficult to do. Assuming you are already familiar with instances.

In a numericField exit event, add some if logic along the lines of this:

1508059_pastedImage_0.png

Note:

• This is a basic way of doing this to make it easier to understand, but you could more elegantly do it with a loop. A loop will also mean you dont have to have an if for every number. You could also use switch instead of if.

• This will always add the numbers of rows specified to the bottom of the table. It wont make the table the rows specified. ie. if you have three rows and specify three rows, the table with now have 6. If you exit the numericField again, the table with have 9 rows and so on.

Magus069
Level 10
Level 10

Hi there,

technically, there is a way much easier than this.

assuming you have a minimum value for the row you can use the following code:

This will not simply add rows, it will create the number of rows specified in the other field.

Enjoy.

MinusZero
Level 7
Level 7

Thats awesome Magus069 for creating a easy resizing table. You can also use it in the exit event of a combo to 'restrict' how many rows can be in the table.

I saved that to my code archive.