View Single Post
Old 10-12-2011, 02:15 AM   #14
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Use the following for the plugboard template.
Code:
program:
# Grab a copy of the series text
s = field('#abbrseries');
# Work out if the series index has a decimal point. If so, format it nn.n, otherwise format it nn
i = field('#abbrseries_index');
index = switch(i, '\.', format_number(i, '{0:04.1f}'), format_number(i, '{0:02d}'));
# Construct the full title containing the series & index
full = strcat(
	s,
	' ',
	index,
	' - ',
	field('title')
);
# Select the full value computed above if there is something in #abbrseries, otherwise use only the title.
first_non_empty(
	test(s, full, ''), 
	field('title')
)
Note that you can also use this template in a custom column 'built from other columns'. Sometimes that is useful for debugging and changing things, as you see the results immediately instead of after a send to your kindle.
chaley is offline   Reply With Quote