10-03-2013, 08:15 PM | #1 |
Addict
Posts: 306
Karma: 679580
Join Date: Dec 2011
Location: Brisbane, Australia
Device: K3, K4NT, KPW2, Voyage, iP4, iP6, iPad Mini, HP TouchPad, Kobo Mini
|
Template for custom column
I am trying to create a Calibre custom column built from the Author Sort field, using the first (or only) author's name.
Can someone help me with the template for that please. |
10-03-2013, 09:28 PM | #2 |
Handy Elephant
Posts: 1,736
Karma: 26785668
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Thinkpad E595, Ubuntu Mate, Huawei Mediapad 5, Bouye Likebook Plus
|
{author_sort:list_item(0,&)}
|
Advert | |
|
10-04-2013, 01:41 AM | #3 |
Addict
Posts: 306
Karma: 679580
Join Date: Dec 2011
Location: Brisbane, Australia
Device: K3, K4NT, KPW2, Voyage, iP4, iP6, iPad Mini, HP TouchPad, Kobo Mini
|
Thank you, Adoby.
|
10-04-2013, 04:59 AM | #4 |
Addict
Posts: 306
Karma: 679580
Join Date: Dec 2011
Location: Brisbane, Australia
Device: K3, K4NT, KPW2, Voyage, iP4, iP6, iPad Mini, HP TouchPad, Kobo Mini
|
Hello Adoby...
Please bear with me again. That is the first time I have used templates. I am trying to extend the template above to replace the comma in the author_sort field with a semi-colon, so that Smith, Bill becomes Smith; Bill. I assume that I need to use the re function, and came up with: {re({author_sort:list_item(0,&)},,,} but I expect I shall need to use some sort of escape character to distinguish the pattern argument comma from the separator commas between the function arguments. Then, I am uncertain how I should combine the two functions, once I have expressed the re function correctly. Just applying the initial template you provided has shown me what a time-saver they can be, and I want to become more fluent in their use. |
10-04-2013, 05:19 AM | #5 | |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I would use general program mode because this template will be used in a custom column. GPM templates used in custom columns are compiled and run significantly faster than the other kinds, which is important when browsing large libraries containing such columns. A GPM template to do what you want is: Code:
program: asort = list_item(field('author_sort'), 0, '&'); re(asort, ',', ';') Code:
{author_sort:'re(list_item($, 0, '&'), ',', ';')'} |
|
Advert | |
|
10-04-2013, 08:55 PM | #6 |
Addict
Posts: 306
Karma: 679580
Join Date: Dec 2011
Location: Brisbane, Australia
Device: K3, K4NT, KPW2, Voyage, iP4, iP6, iPad Mini, HP TouchPad, Kobo Mini
|
Wow, chaley...
I've a lot to learn. Thanks for your input. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugboard, template, and custom composite column recipes | chaley | Library Management | 976 | Yesterday 06:29 PM |
Custom column returns value based on value of another custom column? | calvin-c | Calibre | 3 | 09-14-2013 02:24 PM |
Custom yes/no column built from long text column | Philantrop | Library Management | 7 | 03-23-2013 07:44 PM |
[Custom Column - Composite] Template Help Requested | Ealdwulf | Library Management | 2 | 06-16-2012 04:58 AM |
Help with template for custom column from tags | africalass | Library Management | 2 | 07-16-2011 11:47 AM |