New question:
I have a composite colum, #chapters, which formats the chapter count:
Code:
program:
input = $#kobobookmark;
# Don't change this to 'count' as that's a function
ccount = $$#chaptercount;
if
## Checks that a Fanfiction has a Kobo bookmark of the right format and is not anthology|oneshot
$#booktype=='Fanfiction'
&& substr(input, 0, 10) == 'OEBPS/file'
## I'm not sure why this line is backwards
&& $#fanficstatus in 'Anthology,Oneshot'
then
## Extracts number from bookmark, subtracts 1, and then formats them as 'currentchap/totalchap'
strcat(format_number(re(input, '.*\/file(\d+).*', '\1') - 1, '{0:,d}'), '/',ccount)
## Display 'Not Set' if there's no chapter count
elif
ccount == 'None'
then
'Not Set'
## Display regular chapter count - ignore '1' on most books (magazines, reference books, etc)
elif
$#booktype=='Fanfiction'
||ccount >#1
then
ccount
fi
If the conditionals match, lines the first if-then makes a result that looks like '10/20' or '5/5.' (I use this to track how many chapters I've read in a fanfic.

)
I have a stored template,
fanfic_unreadchaps(), that checks the composite column and subtracts the first number from the second. 10/20 produces '10' and 5/5 produces '0.'
Code:
program:
if '/' in $#chapters then
f = re($#chapters, '(.*)/.*', '\1');
s = re($#chapters, '.*/(.*)', '\1');
(s - f)
fi
This is used in several places; saved searches, column colour/icon rules, action chains templates.
Would performance improve much if I used something like this, that checked the relevant columns directly rather than the composite?
Code:
program:
input = $#kobobookmark;
if
$#booktype == 'Fanfiction'
&& substr(input, 0, 10) == 'OEBPS/file'
&& !$#fanficstatus in 'Anthology,Oneshot'
then
currentchap = re(input, '.*\/file(\d+).*', '\1') - 1;
totalchap = $#chaptercount;
totalchap - currentchap
fi