Dynamically adding widgets to a web page

Hi everyone,

Newbie question:

Is there a way to dynamicall add widgets (i.e., web controls) to a page in run-time?

For example, let's say i have an input form in a page and that page has a screen parameter "Number_Of_Rows" that came from a previous screen. What i'm looking for is:

If Number_Of_Rows = N i would display N edit rows of a certain entity.

Any thoughts on how to do this?

The "IF" widget would allow to do this but it's not a "pretty" solution at all since the page would have to look something like this:

IF (Number_Of_Rows = 1)
<Input 1>
ELSE IF (Number_Of_Rows = 2)
<Input 1>
<Input 2>
ELSE IF (Number_Of_Rows = 3)
<Input 1>
<Input 2>
<Input 3>

Thanks for your help!
Hi Bruno,

Welcome to OutSystems community! I hope that you'll find all the answers you need in this forum and that in the near future also you can help others by answering their questions or by posting interesting topics, ideas and solutions.
Don't forget to browse the solutions area, where you can find already made solutions that you can easily use out-of-the-box and extend to your needs, and the academy where you can find tutorials, samples and certification information.

Answering your question, You could use a table record has an edit form.
This is a common pattern when we want to edit several instances of an entity at the same time. In more detail, imagine you have your page which receives the Number_of_Rows parameter. Imagine the following scenarios: You query the database for the entity instances you want and you limit your query results to that Number_of_Rows. Then you assign the record list to the table record has you'd normally do but you replace the expression with an input field. Now you have two options for saving your data you can do it row-wise or you can do it table-wise in a bulk fashion. To do it row-wise you'll had a button to the table row. In the context of the action associated with the button you can use TableRecord.current.ENTITY to store the data the user entered. Or you can do it table-wise putting a button in the the page and in the action cycle through the record list and storing the data the user entered.

For more information take a look into this sample that you can find in our community site http://www.outsystems.com/Tutorial/More_Samples.aspx#InlineEdit

I hope and could shed some light on your doubts,
Hi Andre,

Firstly, thanks for your words and a big congrats to all the O.S. team for the outstanding work being done!

I'm a new user looking forward to doing a lot more with O.S. tools in the near future.

Your answer did help and i was able to tackle it already!...The reason why this was a bit challenging is because i wanted to, not only edit existing records, but also be able to add N new records to an Entity and i found a way to do it with your leads!

Thanks a bunch!