View Single Post
Old 05-28-2025, 06:11 AM   #1050
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Reader4106 View Post
(Translated from German using Google Translate)

I hope I'm in the right place with my question.

I have two custom columns in Calibre. Both are hierarchically structured.
The first column has the following labels:
Lookup name: #genre.
Column heading: Genre.
Normally, only one (comma-separated) value appears. However, there are a few cases with more than one entry.
The first/top level consists of a "sort character" such as _, §, °, , etc., followed by several sublevels, which are separated by "." as usual.

The contents of the second column have the following labels:
Lookup name: #genre_rg.
Column heading: Genre (ReadingGoal).

This should now be created in a "flattened" form from the values ​​of the first column.
By "flattened," I mean the following:
- The sorting level should be filtered out.
- The second and third hierarchy levels should remain.
- The remaining levels should be ignored.
Here are some examples:
_.Belletristik.Roman.Spannung.Krimi.+nl → Belletristik.Roman
§.Sachbuch.Geschichte.Weltgeschichte.Menschheit → Sachbuch.Geschichte
#.Zeitschrift.Geschichte.Kultur.Menschliche → Zeitschrift.Geschichte
≡.Essayistisches.Kurzgeschichten.Reiseessays → Essayistisches.Kurzgeschichten
_.Belletristik.Roman.Cli-Fi, _.Belletristik.Roman.Dystopisch → Belletristik.Roman, Belletristik.Roman
§.Sachbuch.Gesundheit.Lebenshilfe.Beziehung.Sexual ität, Sachbuch.Wissen.Evolution.Mensch/Tier → Sachbuch.Gesundheit, Sachbuch.Wissen
What are you actually asking for? If the custom column #genre_rg is a "Column like tags" then you fill it in yourself, perhaps using the Action Chains plugin "Single Field Edit" to calculate the value using a template.

If #genre_rg is a "column built from other columns then you fill it in using "subitems()" function in a template to select the second and third values from a hierarchy.
chaley is offline   Reply With Quote