Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-03-2022, 01:25 PM   #1
Hukuro
Junior Member
Hukuro began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2022
Device: none
How to search for only the first occurence in a series?

Hello everyone. Thank you for this wonderful program, I want to make a nice digital library with it. I need just one more thing to fully customize my "shelf". I want the program to display only the first available book in any series.

So far I've been using the search query:
Code:
not series_index:>1
But it's not ideal because I don't own volume 1 for some series. For example I own only volume 4 of a series of 5.

Can somebody more experienced or intelligent give me the code I need?

Happy reading everyone.
Hukuro is offline   Reply With Quote
Old 10-04-2022, 04:07 PM   #2
allanahk
Connoisseur
allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.
 
allanahk's Avatar
 
Posts: 71
Karma: 2202292
Join Date: Nov 2018
Device: Kobo Libra 2
Hi there, I have a custom column which essentially does what you're asking - it's True if the book is either standalone or first in series (even if the series index doesn't begin at 1) and False otherwise. I find it useful to have this info in a column (called #first_in_series) so I can search very easily (either #first_in_series:=True or False). Here are the steps:

1. Preferences - Advanced - Tweaks - set "allow_template_database_functions_in_composit es = True"

2. Add column - column built from other columns (see attached pic)

3. Copy this code into the column template:

Code:
program: 
# Returns True if it is the first book in a series (or a standalone book with no series), including cases where the series index does not begin at 1. 
# Returns False otherwise

first_in_series = 'True';

if field('series') then 
	this_series = field('series');
	this_series_index = field('series_index');
	books_in_series = book_values('title', 'series:="' & this_series & '"', ',', 0);
	
	lowest_series_num = 999;
	for title in books_in_series:
		title_index = book_values('series_index', 'title:="' & title & '"', ',', 0);
		if title_index < lowest_series_num then
				lowest_series_num = title_index
		fi
	rof;	
	
	if lowest_series_num !=# this_series_index then
		first_in_series = 'False'
	fi
fi;

output = first_in_series
Attached Thumbnails
Click image for larger version

Name:	temp.PNG
Views:	110
Size:	19.5 KB
ID:	196984  
allanahk is offline   Reply With Quote
Old 10-04-2022, 04:19 PM   #3
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by allanahk View Post
Hi there, I have a custom column which essentially does what you're asking - it's True if the book is either standalone or first in series (even if the series index doesn't begin at 1) and False otherwise.
FWIW I think this would be better as a template search. That way you pay the performance penalty only when you want instead of every time the book list is displayed. See "Search using templates" in the Search Interface section calibre manual.
chaley is offline   Reply With Quote
Old 10-04-2022, 04:26 PM   #4
allanahk
Connoisseur
allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.allanahk ought to be getting tired of karma fortunes by now.
 
allanahk's Avatar
 
Posts: 71
Karma: 2202292
Join Date: Nov 2018
Device: Kobo Libra 2
Quote:
Originally Posted by chaley View Post
FWIW I think this would be better as a template search. That way you pay the performance penalty only when you want instead of every time the book list is displayed. See "Search using templates" in the Search Interface section calibre manual.
I thought the same, and I agree it's probably the better way to do it. My library isn't enormous so I haven't noticed any performance slowdowns, but for a larger library it might be an issue and in that case I'd also recommend using a template search instead.

I just really like custom columns
allanahk is offline   Reply With Quote
Old 10-05-2022, 10:24 AM   #5
Hukuro
Junior Member
Hukuro began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2022
Device: none
Quote:
Originally Posted by allanahk View Post
1. Preferences - Advanced - Tweaks - set "allow_template_database_functions_in_composit es = True"
I studied the Tweaks file and the above option is not there. I'm afraid it's only available in the later versions, mine is 5.44. Sadly, I can't update the program further from Windows 8.1
Hukuro is offline   Reply With Quote
Old 10-05-2022, 11:04 AM   #6
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Hukuro View Post
I studied the Tweaks file and the above option is not there. I'm afraid it's only available in the later versions, mine is 5.44. Sadly, I can't update the program further from Windows 8.1
Then the template can't work. The book_values() function was added in version 6.something.

You might be able to do it with the action chains plugin, doing a search similar to what is in this thread then setting a tag or a yes/no column for the books it finds. Ask in its thread in the plugins forum. I don't know if the plugin still supports calibre 5.44.

Last edited by chaley; 10-06-2022 at 11:00 AM. Reason: Typo
chaley is offline   Reply With Quote
Old 10-05-2022, 04:13 PM   #7
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,033
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by Hukuro View Post
I studied the Tweaks file and the above option is not there. I'm afraid it's only available in the later versions, mine is 5.44. Sadly, I can't update the program further from Windows 8.1
Anyone stuck on 32 bit Linux (e.g. Mint 19.3 32bit is still supported) or 32 bit Win10 due to CPU type is also limited to Calibre 5.44. Still it's better than XP or Win7.
Quoth is offline   Reply With Quote
Old 10-05-2022, 04:24 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Hukuro View Post
I studied the Tweaks file and the above option is not there. I'm afraid it's only available in the later versions, mine is 5.44. Sadly, I can't update the program further from Windows 8.1
Is there any reason you cannot upgrade to Windows 10 64-bit? The upgrade is still free.

This articel will tell you what you need to know.
https://www.laptopmag.com/articles/h...ade-windows-10

Last edited by JSWolf; 10-05-2022 at 04:52 PM.
JSWolf is offline   Reply With Quote
Old 10-05-2022, 04:33 PM   #9
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
oh for god's sake
ownedbycats is offline   Reply With Quote
Old 10-05-2022, 04:56 PM   #10
jmurphy
Zealot
jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.
 
Posts: 110
Karma: 1133068
Join Date: Sep 2007
Device: ipaq
Quote:
Originally Posted by ownedbycats View Post
oh for god's sake
Hold my beer.

Quote:
Originally Posted by JSWolf View Post
Is there any reason you cannot upgrade to Windows 10 64-bit? The upgrade is still free.
Why haven't you upgraded to Win11 22H2 yet? It's freeeeeeeeeeeeee!
jmurphy is offline   Reply With Quote
Old 10-05-2022, 04:57 PM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by jmurphy View Post
Hold my beer.

Why haven't you upgraded to Win11 22H2 yet? It's freeeeeeeeeeeeee!
My laptop does run Windows 11. My Surface Pro 2 does not.
JSWolf is offline   Reply With Quote
Old 10-06-2022, 09:31 AM   #12
Hukuro
Junior Member
Hukuro began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2022
Device: none
Quote:
Originally Posted by chaley View Post
You might be able to do it with the action chains plugin, doing a search similar to what is in this thread then setting a tag or a yes/no column for the books it finds. Ask in its thread in the plugins forum. I don't know if the plugin still supports calibre 5.44.
Thanks. The plugin runs on my version. I asked for help in the thread you mentioned

I also found a simple workaround for the time being. I mark books manually, with a custom value.

Quote:
Originally Posted by JSWolf View Post
Is there any reason you cannot upgrade to Windows 10 64-bit? The upgrade is still free.
Long story
Spoiler:
As tempting as that update may be, and considering how many services drop support for Windows 8.1, sometimes leaving broken apps behind (iTunes…), I have a bad history with Windows 10. I had it for a while in the past because it installed itself on my machine after I left the room for a couple of minutes. As it quickly turned out, that new Windows ran many forced and troublesome processes, half of them in the background and without my knowledge, for example downloading things. Just thinking about it takes me back to the times of the forever-in-my-heart internet connection of 60 kb/s download. I couldn't even load Google page, let alone download studying materials, because Windows 10 was always downloading something in the background, and obviously couldn't finish it with such a poor download speed. After a few years my laptop broke and I had to reset it to the factory settings, which took me back to Windows 8.1, with which I have stayed to this day. The forced update and intrusive policy of Windows 10 left a lasting bad taste.

If anyone made it to this point, thank you for reading through this tragic event of my life
Hukuro is offline   Reply With Quote
Old 10-06-2022, 03:02 PM   #13
Hukuro
Junior Member
Hukuro began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2022
Device: none
The solution for Calibre 5.44 – Action Chains Plugin
The solution for later versions – above in this thread, by courtesy of allanahk.

Thanks for help, everyone

Hukuro is offline   Reply With Quote
Old 10-06-2022, 04:41 PM   #14
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Addendum to your question

Quote:
Originally Posted by Hukuro View Post
Hello everyone. Thank you for this wonderful program, I want to make a nice digital library with it. I need just one more thing to fully customize my "shelf". I want the program to display only the first available book in any series.
As an addendum to your desired function, you might be interested in this 5 year-old post https://www.mobileread.com/forums/sh...87&postcount=8 from the Multi-Column Search (MCS) plugin using its "SQL Query" Tab. Note that post's attached images that show exactly how that specific query works.



DaltonST
DaltonST is offline   Reply With Quote
Old 10-06-2022, 04:51 PM   #15
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,611
Karma: 7891011
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by Hukuro View Post

Long story
Spoiler:
As tempting as that update may be, and considering how many services drop support for Windows 8.1, sometimes leaving broken apps behind (iTunes…), I have a bad history with Windows 10. I had it for a while in the past because it installed itself on my machine after I left the room for a couple of minutes. As it quickly turned out, that new Windows ran many forced and troublesome processes, half of them in the background and without my knowledge, for example downloading things. Just thinking about it takes me back to the times of the forever-in-my-heart internet connection of 60 kb/s download. I couldn't even load Google page, let alone download studying materials, because Windows 10 was always downloading something in the background, and obviously couldn't finish it with such a poor download speed. After a few years my laptop broke and I had to reset it to the factory settings, which took me back to Windows 8.1, with which I have stayed to this day. The forced update and intrusive policy of Windows 10 left a lasting bad taste.

If anyone made it to this point, thank you for reading through this tragic event of my life

IMO, seven was the last acceptable Windows OS </rant>
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to search tags and series? JJ Johnson Calibre 3 10-26-2020 01:57 AM
Search series and tags DirCat Library Management 7 10-02-2019 04:13 PM
Search And Replace using Series value? Robmonster Calibre 7 11-15-2011 10:59 AM
search series number Stampercam Calibre 2 05-30-2011 02:53 AM
search for series number speakingtohe Calibre 4 08-29-2010 01:21 PM


All times are GMT -4. The time now is 10:31 PM.


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