redeclared datamap in a higher scope

checked the size of the dataMap before looping to add form fields