There are a couple of ways to do this; one is to make the contact documents responses to the customer document; then you can use a regular hierarchical view.
Otherwise, if you want the category to be the customer name, this would require the customer name to be stored in the contact documents as well as the customer documents. The view column formulas can only return values that are actually stored within a single document — there are no “joins” like a relational database. I assume you also want the customer document to appear first, with the contacts beneath.
There are several different ways to organize this sort of view, but in general, you would start out with a categorized column that returns the customer name. If you’re smart, you’ll use the same fieldname for this information on both forms, so that the column can just display this field. Otherwise, you’ll have to do something like: @If(Form = “Customer”; Name; CustName)
You will probably want to have the customer document appear first. This can be done in a couple of ways: one, you can use a hidden sorted column to the right of the categorized column, and sort by Form, descending (for instance). Or, if you would like the view to look like this:
(twistie) Ferrous Industries
Roland Ferrous 302-555-2020
then the category formula could be CustName + @If(Form = “Contact”; “\\contacts”; “”)
Or, experiment with the hidden sorting column and “categorized is flat” option.
Of course, other columns besides the categorized column might have to test the form to decide what fields to display there. This is one nice thing about the response documents option — because you have a “responses only” column you can put what you like there and know what form it’s coming from.