How to get data from a child table through a template?

I followed the implementation guide and created a content type with a child data table, and the content type is working because I can use the editor to insert data to the database, and I can view it and can edit it.
The only problem is how to pull the child data and populate the page. I created a page template to have #children(“details” “template1” $header $beforetext $aftertext $footer) to display the child data.
In my template1, I used <td>#field(“city”), #field(“state”)</td>. And I put table and row tag in header, beforetext, aftertext and footer.
The error I got is “java.lang.NullPointerException”
I know something is wrong in my template1, but I dont know what exactly I need to change. should I use loop to get the record?
Thanks

You are on the right track, this is exactly how you are supposed to fetch child data table data. In your snippet template, try prefixing your field name “rx:”.

I am a fan of looping through rows instead of using a template for children. There’s already a thread for Stepping through Child Table Rows. The only problem with this approach is that it is not really usable with Active Assembly.