View Single Post
Old 06-13-2025, 06:04 AM   #13
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,456
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Code:
program: 
switch_if(
	$series_index ==#'0', '',
	$series_index
	)
Worked. Have not figure out how to turn 1.04 into 1-4 though.
Assuming you use n.m only for omnibus-style books, multiple books in order, and not for intermediate books e.g. a book 2.5 that falls between 2 and 3, then this might work:
Code:
program:
	series_start = floor($series_index);
	fraction = fractional_part($series_index);
	if fraction ==# 0 then
		result = series_start
	else
		series_end = floor(fraction*100);
		if series_end >=# 0 then
			result = series_start & '-' & series_end
		fi
	fi;
	result
This template assumes you always use 2 digits in the fraction. How to disambiguate single digit fractions and 2 digit fractions isn't obvious.

Also, if you have both omnibus and intermediate books (as I do) then you would need some way to distinguish between them. I would use a Yes/No "Is Omnibus" column for this.

It might be easiest in the long run to have a text custom column that contains the series string you want for the book.

Quote:
Maybe this could be split into a thread for development subforum.
I put it in the devices forum.
chaley is offline   Reply With Quote