Expand my Community achievements bar.

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

Avatar

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

Avatar

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.

Avatar

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.

Avatar

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.