How to add coulums to a grid dynamically

Hi All,

Pls help me out with the following scenario in AX 2012.

I have a requirement to generate columns in a grid and the no of columns that have to be added/generated depends on the value of a field in some other table. For ex of I have a table TblParm and form TblParm and it has NoOfEmployees as one of its the field. I have a form FormDiscrete and the grid in this form should be having as many columns as NoOfEmployees field.

I am not getting as to how to proceed. Any help will be highly appreciated !!!

Thanks in Advance!!

Preeti

Look at how SysTableBrowser form is implemented, is adds all columns dynamically. See especially addField() method in SysTableBrowser class.

Nevertheless databases (and GUI bound to databases) work much better with dynamic number of rows than dynamic number of columns. Try to think about the design once more.