12-02-2023, 05:02 PM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Dec 2023
Location: United Kingdom
Device: Kobo Aura One/Kobo App on Android 14
|
Hierarchical Custom Composite Columns
I have been successful in creating a custom column that combines other columns. For that I used the one that acts like tags. This is the template:
{#series1:||,}{#series2:||,}{#series3}. However, when I try to proceed with making the custom column hierarchical, it does not show up in custom metadata and the tags are not draggable. For example, this is a previous column that works: and my current one which does not: Is creating a hierarchy something that you cannot do with custom composite columns, or am I missing something? Thanks |
12-04-2023, 12:50 AM | #2 |
Zealot
Posts: 109
Karma: 53342
Join Date: Jun 2013
Device: Sony PRS-600
|
At a guess...
The delimiter for hierarchical tag browser entries is '.', not ','. And ending with '.' causes the hierarchy to break. That is, "A,B,C." gives you an entry that is "A,B,C." If instead you do {#series1:||.}{#series2:||.}{#series3} You should find it works. Notice that I did not include the '.' at the end of the template. Having '.' at the end of the template forces the result to be treated as a non-hierarchical value. In my test I used a mix of custom and built-in fields: {#titlecount:||.}{#pagecount:||.}{series:||.}{#pub series:||.}{#pubseries_index} giving me
With the trailing '.', I get
Which brings up another observation: this works if and only if your last entry in the template exists. If it doesn't, but one or more of the entries ahead of it does, then you end up with a spurious trailing '.'. |
Advert | |
|
12-04-2023, 12:52 AM | #3 | |
Zealot
Posts: 109
Karma: 53342
Join Date: Jun 2013
Device: Sony PRS-600
|
Quote:
Perhaps different markup... Code:
{#titlecount:||.}{#pagecount:||.}{series:||.}{#pubseries:||.}{#pubseries_index} |
|
12-04-2023, 02:39 AM | #4 | |
want to learn what I want
Posts: 993
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Quote:
https://www.mobileread.com/forums/sh...postcount=1166 However I couldn't get rid of that space for the life of me, lol. |
|
12-04-2023, 03:28 AM | #5 |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
Advert | |
|
12-04-2023, 06:34 AM | #6 | |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
{#titlecount:}{#pagecount:|.|}{series:|.|}{#pubseries:|.|}{#pubseries_index|.|} Code:
program: list_join('.', $#titlecount, '.', $#pagecount, '.', $series, '.',$#pubseries, '.', $#pubseries_index, '.') Code:
{:'list_join('.', $#titlecount, '.', $#pagecount, '.', $series, '.',$#pubseries, '.', $#pubseries_index, '.')'} |
|
12-04-2023, 09:27 AM | #7 |
Junior Member
Posts: 2
Karma: 10
Join Date: Dec 2023
Location: United Kingdom
Device: Kobo Aura One/Kobo App on Android 14
|
Thanks
Thanks for your help. The '.' instead of ',' thing should have been obvious to me. I still don't seem to be able to get it to work though. I figure it is probably something wrong with the columns that I am trying to combine. Honestly I'm not very good at this sort of thing.
|
12-06-2023, 01:03 AM | #8 | |
Zealot
Posts: 109
Karma: 53342
Join Date: Jun 2013
Device: Sony PRS-600
|
Quote:
Code:
program: '.'.join(filter(None, ($#titlecount,$#pagecount,$series,$#pubseries,$#pubseries_index))) |
|
12-06-2023, 06:09 AM | #9 | |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
python: def evaluate(book, context): vals = (filter( None, ( book.get('#myint2'), book.get('#pagecount'), book.get('series'), book.get('#series'), book.get('#series_index'))) ) vals = ((str(v) if isinstance(v, (int, float)) else v) for v in vals) return '.'.join(vals) |
|
12-08-2023, 02:37 AM | #10 | |
Zealot
Posts: 109
Karma: 53342
Join Date: Jun 2013
Device: Sony PRS-600
|
Quote:
Looking at the documentation, the semantics of list_join seems odd to me... but I think I see now how it works. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Composite columns and identifiers | ownedbycats | Library Management | 15 | 05-26-2022 02:32 PM |
Quickview and composite columns | ownedbycats | Library Management | 2 | 12-25-2020 04:43 PM |
[Library Closed Plugin] Save Composite Custom Columns | chaley | Plugins | 22 | 04-11-2020 07:09 AM |
Question about hierarchical columns... | dkplayaclub | Library Management | 14 | 06-27-2016 04:31 PM |
composite custom columns sorted numerically | Doug-W | Library Management | 2 | 02-18-2011 02:16 AM |