Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 06-02-2015, 03:57 AM   #1
Anna_R
Junior Member
Anna_R began at the beginning.
 
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:||,}
This is the column that I use in my labelbrowser and hold just the serietitles and not the index.

Code:
{series} {series_index:|| / }{#secreeks} {#secreeks_index}
The column I use in my mainscreen so I can see in one column if a book has one or more series.

I hope someone understands what i'm trying to accomplish here and has an answer to it.
Attached Thumbnails
Click image for larger version

Name:	ex1.jpg
Views:	385
Size:	136.6 KB
ID:	138924  
Anna_R is offline   Reply With Quote
Old 06-02-2015, 09:39 AM   #2
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,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, '%%%'), '%%%', ' / ')
For the columns that hold just the title would look something like the following:
Code:
program:
	a = field('series');
	b = field('#series');
	re(list_union(a, b, '%%%'), '%%%', ', ')
Edit: change the list separator to ensure that there are no accidental occurrences in the values, such as a series name containing a comma. Also use 'field' instead of 'template' in the second example to improve performance.

Last edited by chaley; 06-02-2015 at 12:04 PM. Reason: improvements to template
chaley is offline   Reply With Quote
Advert
Old 06-02-2015, 03:01 PM   #3
Anna_R
Junior Member
Anna_R began at the beginning.
 
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.
Anna_R is offline   Reply With Quote
Old 06-02-2015, 03:42 PM   #4
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,346
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Anna_R View Post
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.
These are composite column templates, but using a different mode. All you need to do is change the lookup names in the templates to the ones you use then paste them templates into the composite column template.

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.
chaley is offline   Reply With Quote
Old 06-03-2015, 03:59 AM   #5
Anna_R
Junior Member
Anna_R began at the beginning.
 
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
Anna_R is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 08:04 AM.


MobileRead.com is a privately owned, operated and funded community.