View Single Post
Old 09-07-2020, 11:39 AM   #357
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,480
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
It all looks good here.
Thanks for checking!
Quote:
I have a few icon and colour rules across my libraries. Some are simple comparisons, but a few use general program mode.
Standard rules are implemented using generated GPM templates. Good that they work.
Quote:
Code:
program:
if field('series') then
	strcat('__Series__/',field('series'),'/',format_number(field('series_index'),'{0:02d}'),' - ',field('title'),' - ',field('author_sort'));
else
	strcat(substr(field('author_sort'),0,1),'/',field('author_sort'),'/',field('title'))
fi
That is in a custom column and works perfectly.
I am surprised. In GPM a ';' is a statement separator, not a statement terminator. For if-then-else that means a ';' before 'else' or 'fi' is a syntax error. My suspicion is that your quick test was only on books with no series, in which case the interpreter swallows the 'then' part without verifying the syntax.

BTW: the "field()" function is now inlined, directly executed by the GPM interpreter. That means that now there is little performance difference between using a local variable and using "field", where before a local variable was around 10 times faster.
chaley is offline