![]() |
#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. |
![]() |
![]() |
![]() |
#2 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
{author_sort:list_item(0,&)}
|
![]() |
![]() |
Advert | |
|
![]() |
#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.
|
![]() |
![]() |
![]() |
#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. |
![]() |
![]() |
![]() |
#5 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,353
Karma: 8012652
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 | |
|
![]() |
#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. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugboard, template, and custom composite column recipes | chaley | Library Management | 1053 | Yesterday 08:34 AM |
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 |