Include the form in the db query for exports. Issue: #696 #697