First of all, the field code cannot be used in the HTML code, it can only be used in API or the auto-calculation field.
One of the methods of creating a table in the custom view is by creating the item name row with HTML, such as by:
<th>Date of Birth</th>
Then use JS to manipulate the HTML DOM to put the child element (of data) in the HTML tbody.
I hope you get the idea.