07-17-2021, 04:49 PM | #1 |
Member
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
|
Referring to column colors in template
Basically, I have set up a column color rule that I would like to refer to in a custom column template to add a tag based on the color.
I have done the opposite in the past - set up a custom column and refer to it in the color rule - which worked, but I have to update the custom column with info periodically, and since my library is quite large, it takes a long time to save, which is quite inconvenient. However, I found that updating the color rules is much faster, and I can basically use the same template as I had in the custom column. I do still want to add a tag to books as well as color, though, hence my question. If this is not possible, would I be able to do an advanced search based on colors in a column instead? Thank you! |
07-17-2021, 09:06 PM | #2 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I dont believe colors are queryable in any way either by searching or in templates, they are only applied dynamically when the data in question is rendered.
|
Advert | |
|
07-18-2021, 05:49 AM | #3 |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You might be able to do what you want with a stored template. If I am understanding correctly (not at all sure ) then the stored template would compute the color based on the column content. The color rule would 'call' the template and return the color. The composite column template would call the template and do whatever you want with the returned value.
|
07-18-2021, 08:15 AM | #4 |
Member
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
|
Thank you for the stored template idea. I tried it and I believe it would work, but after saving the stored template and returning to the Preferences screen, when I try to close that screen, Calibre freezes. I tried adding the Template Functions button to the menu and accessing it that way, but Calibre still freezes when clicking the Apply button. Not sure if this is because of my library size or an error, but either way, unfortunately, this means it's not a better option to update this periodically than to update a custom column.
|
07-18-2021, 08:22 AM | #5 | |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
What are you doing different from the above? What version of calibre are you running, on what OS? NB: I am the developer of the calibre template language. If there is a hang I really want to know how to reproduce it. |
|
Advert | |
|
07-18-2021, 08:45 AM | #6 | |
Member
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
|
Quote:
I am running calibre 5.21 on Windows 10. In this particular library, I do have over 12k books at the moment, which is probably the issue. I tried the same steps above in a separate library with only a few books, and there was no freezing or delay. |
|
07-18-2021, 09:42 AM | #7 |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
For calibre, 12,000 books isn't that many but it could matter depending on the computer you are using and where the library is stored.
First question: have you ever waited for some time to see if calibre becomes responsive again? When you save a template function, calibre resets its internal data so that any usages of the changed/new function will be taken into account. The reset forces rereading of the database. The speed of this process is mostly determined by a) how the library is sorted, b) whether there is a virtual library active, and c) whether the computer has enough memory to compute everything necessary. In your case:
Last question: have you run it in debug mode? I doubt it would show anything but one never knows. Last suggestion: sometimes the calibre database gets quite large as it collects detritus from change operations. An overly large library database can be slow. Running Library maintenance / Check library (click on the Library button to see this choice) will compact the database. You don't need to run "Check if files" step (but I would just to see). |
07-18-2021, 11:36 AM | #8 | |||||
Member
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
|
Quote:
Quote:
Quote:
Quote:
Quote:
Spoiler:
|
|||||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help me with Custom Column template | nqk | Library Management | 3 | 09-23-2016 10:22 PM |
Copying Template Value to a column | rszasz | Library Management | 1 | 06-15-2016 11:16 AM |
Template for custom column | BeeTee-Ess | Library Management | 5 | 10-04-2013 08:55 PM |
column colors based on what reading list a book is on? | BeccaPrice | Calibre | 3 | 01-22-2012 04:29 PM |
column colors | iomari | Calibre | 2 | 10-07-2011 10:39 AM |