Question:
I want to output to a form a value table whose field count and field data types can change dynamically. How can I do it?
Answer:
You can add or subtract fields to a value table attribute of a form via programming in the module of the form. How to add the columns to the FormDataCollection (which is the representation of the value table as an attribute of the form), how to fill them out and then how to show those to the user by adding the corresponding form items, adding an event to the created form item (form table) are shown in the screenshot below. In the immediate window of the screenshot, it is also shown how to refer to a field of a row by using the name of the field (string data type).