![]() |
#946 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 132
Karma: 14644
Join Date: Sep 2015
Device: Kobo Elipsa, Poketbook Inkpad 3 & Boyue Likebook Minas
|
I'm trying to make a composite column to display the "Reading Status" based on the actual value of a column "%percent read".
I can use the following to set to 'Complete' if %percent read" is set to 100 Code:
{:'cmp(field('#kobo_percent_read'),100,'','Finished','Finished')'} Can this be done? |
![]() |
![]() |
![]() |
#947 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
{#kobo_percent_read:'switch_if($ >= 100, 'finished', $ <= 0, 'unread', 'reading')'} |
|
![]() |
![]() |
Advert | |
|
![]() |
#948 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 132
Karma: 14644
Join Date: Sep 2015
Device: Kobo Elipsa, Poketbook Inkpad 3 & Boyue Likebook Minas
|
Hmm, this only works if #kobo_percent_read is 1. If the value is between 2 and 100 the result is "finished".
Last edited by Amon_Re; 04-30-2023 at 01:58 PM. |
![]() |
![]() |
![]() |
#949 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You might be able to make it work using this template that instructs calibre to treat the values as numbers even if they are declared as text. Code:
{#kobo_percent_read:'switch_if($ >=# 100, 'finished', $ <=# 0, 'unread', 'reading')'} |
|
![]() |
![]() |
![]() |
#950 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 132
Karma: 14644
Join Date: Sep 2015
Device: Kobo Elipsa, Poketbook Inkpad 3 & Boyue Likebook Minas
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#951 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Mar 2023
Device: none
|
Moderator Notice
This post is deleted because it a) has nothing to do with templates, and b) is a repeat of this post. Last edited by chaley; 06-19-2023 at 05:03 AM. |
![]() |
![]() |
![]() |
#952 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Dec 2016
Device: android phone
|
I am working on a metadata plugboard to be used when exporting a book and including all relevant details in the new comment field of the created book. So I have a template program and concatenate all values. The part I am looking for help with is in taking 3 values and printing them out with commas between them. Any of the 3 values might be blank, so I don't want to print a comma for those and don't want a hanging comma.
For example, what I have now, prints out as: ... <tr> <td>Identifier:</td> <td>9781481440967 9781481440950 </td> </tr> ... or ... <tr> <td>Identifier:</td> <td>9780748120550 asin:B0065JMS64</td> </tr> But what I want is: ... <tr> <td>Identifier:</td> <td>9781481440967, 9781481440950 </td> </tr> ... or ... <tr> <td>Identifier:</td> <td>9780748120550, asin:B0065JMS64</td> </tr> Here is my code from the plugboard: isbn1 = test(field('#isbn_enter'),field('#isbn_enter'),'') ; isbn2 = test(field('#isbn_p_enter'),field('#isbn_p_enter') ,''); isbn3 = test(field('#isbn_asin'),strcat('asin:', field('#isbn_asin')),''); OUTPUT6 = test(strcat(isbn1,isbn2,isbn3),strcat('<tr><td>Ide ntifier:</td><td>', isbn1,' ',isbn2,' ',isbn3,'</td></tr>'),''); I see a function for creating a list and then printing out that list with separators. However, there are no good examples on how to use the function. Any help? |
![]() |
![]() |
![]() |
#953 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: ids = list_remove_duplicates($#isbn_enter & ',' & $#isbn_p_enter & ',' & $#isbn_asin, ','); if ids then OUTPUT6 = strcat('<tr><td>Identifier:</td><td>', ids, '</td></tr>') else OUTPUT6 = '' fi
|
|
![]() |
![]() |
![]() |
#954 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
|
@Chaley..I was directed here from such an inquiry in a LibMgmt thread....Just want to say thank you for this!!!
|
![]() |
![]() |
![]() |
#955 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
|
I have a custom column #date_range that's populated via FanFicFare using the date updated and date published metadata. I have a regex for it in FFF's settings:
Code:
## diff dates 1pmonth 2pday 3pyear 4umonth 5uday 6uyear dateRange_LIST=>([^\s]+)\s+(\d{1,2})\,\s+(\d{4})\,\s([^\s]+)\s+(\d{1,2})\,\s+(\d{4})=>\1 \2, \3-\4 \5, \6 ## same year 1 2 3 4 5 dateRange_LIST=>([^\s]+)\s+(\d{1,2})\,\s+(\d{4})-([^\s]+)\s+(\d{1,2})\,\s+\3=>\1 \2-\4 \5, \3 ## same month 1 2 3 4 dateRange_LIST=>([^\s]+)\s+(\d{1,2})-\1\s+(\d{1,2})\,\s+(\d{4})=>\1 \2-\3, \4 Different dates: January 1, 2022-April 1, 2023 Same year: May 20-August 23, 2023 Same month: August 10-15, 2023 Same day: August 23, 2023 And so I was wondering if this is also possible to do with a column built from other columns + templates since I have published date and updated date columns. |
![]() |
![]() |
![]() |
#956 | |
Enthusiast
![]() Posts: 35
Karma: 10
Join Date: Feb 2011
Device: Kindle Paperwhite, Kobo Aura One
|
Quote:
Cant't get this template still work with a 2013 Paperwite in Calibre 6.11 om Mac OS 10.15.7. Don't know if I am doing something wrong or if the template is to old. Last edited by PapaJohn; 09-14-2023 at 11:16 PM. |
|
![]() |
![]() |
![]() |
#957 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Oct 2023
Device: kobo libra 2
|
Keep only initial 2 characters of each word
I'm sure this is the easiest solution ever but the Calibre Template Language guide is going entirely over my head. I'd like to understand how to modify the code below to include the first 2 (rather than 1) characters of each word in text string. But, if the text string is just one word, I'd like to include the first 4 characters. I thought the "\1" indicated the number of characters but was definitely wrong on that front
![]() {#textstring:re([\s]?([^\s])[^\s]+(\s|$),\1)} Example: Lord of the Rings --> LoofthRi Villains --> Vill Thank you in advance! |
![]() |
![]() |
![]() |
#958 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
{series:'contains($, ' ', re($,'\s*(\S{{,2}})\S*(?:\s|$)','\1'), re($, '^(\S{{,4}}).*$', '\1'))'} |
|
![]() |
![]() |
![]() |
#959 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Oct 2023
Device: kobo libra 2
|
Thank you so much!!
|
![]() |
![]() |
![]() |
#960 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Oct 2023
Device: kindle PW signature edition
|
Hi
I'd like transfer my book on my new kindle with the following structure Library/Author/Title but I'm not able to obtain "Library" automatically I'm trying to create a column with the name of the library, maybe using the function current_library_name(), but I always obtain an empty field. Any suggestion Thank you in advance |
![]() |
![]() |
![]() |
Tags |
custom column, tag, tags |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
custom column i need a little help | shinken | Calibre | 3 | 09-15-2010 03:41 AM |
Using Custom Metadata in Save Template | EJvdH | Calibre | 1 | 07-02-2010 06:06 AM |
Accessories Decalgirl Kindle 2 custom skin template | srmalloy | Amazon Kindle | 6 | 04-09-2010 09:55 PM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |