I don’t think you’re gonna be able to do the whole thing dynamically eg read the number of data types off the DB and then pull the number of fields for each data type dynamically from the DB.
I would probably look at Option Sets to use as a reference for your data types. I would enter each data type that you want to include in your list as an option in the option set eg called _DataTypes and add an attribute to the option set for “No of Fields” and enter the number of fields into the attribute for each data set. You can then use the Option Set as the Data Source for the RG. Then use the No of Fields attribute of the selected option to determine the number of “Field” rows in the second RG for the fields. To do that use a number generator such as Keith’s List Shifter by setting the list shifter’s Number of Items to the No of Fields attribute of the selected option set. Then have your second RG (containing your fields) with a Data Type of Number and a Data Source pointing to the list shifter.
When a Data Type is selected in the first RG, pop the selected option in to a custom state and set the Number of Items on the List Shifter to the custom state’s No of Field attribute. That way you’ll have the right number of rows in your Fields RG based on the data type they select in the first.
Hope this helps.