I have a similar problem. I have created a hierarchical custom column for genres. The genres include no more than three levels:
In book details, I would like to have the following genres displayed: linguistics, sociolinguistics, gender.
Analogically, if there are some genres with two or one level only, I would like to have all the parts displayed separated by comma in the book details.
linguistics.sociolinguistics => linguistics, sociolinguistics
I would like to create a separate custom column based for that. What code should I use?