![]() |
#1 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jun 2015
Location: The Netherlands
Device: Sony PRST-1
|
Composite column template question
Hi,
First of all: Hope my english is correct enough for you to understand what I mean ![]() I've been reorganising my Calibre and added an extra series-column for secundairy series (ex: Preston & Child's Pendergast novels have a couple of subseries) Afterwards i've composed a column which uses the value of other columns. In this case it uses the data from the original series-column and my custom series-column. This works fine but now i'm a bit stuck on the detailing as you can see on the screenshot i've made. I can't get rid of the comma or the slash if i've only got one column filled. Where 2 columns are filled (so in a case where a book has multiple serie-titles) everything's fine, but just one series-column goes wrong. My 'strings' for these colums are: Code:
{series:||,} {#secreeks:||,} Code:
{series} {series_index:|| / }{#secreeks} {#secreeks_index} I hope someone understands what i'm trying to accomplish here and has an answer to it. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,346
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You need a way to insert a separator (comma or slash) if both items have values. One way to do that is to treat them as lists each with zero or one value then merge the lists. The separator will be added if there are two values.
The following general program mode template is an example for your column that holds the indices. Code:
program: a = template('{series} {series_index}'); b = template('{#series} {#series_index}'); re(list_union(a, b, '%%%'), '%%%', ' / ') Code:
program: a = field('series'); b = field('#series'); re(list_union(a, b, '%%%'), '%%%', ', ') Last edited by chaley; 06-02-2015 at 12:04 PM. Reason: improvements to template |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jun 2015
Location: The Netherlands
Device: Sony PRST-1
|
I'm afraid this is too technical for me. I thought it was just a matter of typing something in template field in the custom column creator. This looks like actual programming in the advanced section. If there is no "easy" way then I'll just have to learn to live with the "imperfection". Thanks for your help anyway, perhaps someone else could use your answer to his of her advantage.
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,346
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The easiest way to enter these templates into your composite columns is to click on any cell in the column, press F2 or whatever the edit key is on your platform, then paste the template into the resulting template editor. |
|
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jun 2015
Location: The Netherlands
Device: Sony PRST-1
|
Wow, it looked more difficult then it actually was! Thanks for all the help, I've never worked with that method so I was kinda scared that I would ruin things.
Happy camper here ![]() |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugboard, template, and custom composite column recipes | chaley | Library Management | 1047 | 04-24-2025 10:28 PM |
Composite Column | BetterRed | Calibre | 12 | 09-01-2013 04:58 AM |
[Custom Column - Composite] Template Help Requested | Ealdwulf | Library Management | 2 | 06-16-2012 04:58 AM |
Composite column or not ? | Bertrand | Library Management | 3 | 08-24-2011 01:27 AM |
Custom Composite Column | silentguy | Calibre | 4 | 11-24-2010 10:28 AM |