View Single Post
Old 09-08-2013, 05:50 PM   #12
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,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Taking a guess, the template would look something like
Code:
program: 
	c = field('#category');
	template1 = template('{#category}/{#sub_category}/{series}/{title}{series_index:0>4.1f}{authors}'), '');
	template2 = template('{#genre}/{#sub_genre}/{series}/{title}{series_index:0>4.1f}{authors}');
	first_non_empty(
		strcmp(c, 'Tort Law', '',  template1, ''),
		strcmp(c, "some other post grad category", '', template1, ''),
		template2
	)
The first template would be chosen if the category equals "Tort Law" or "some other post grad category". You would put a line into the template for each possible post-grad category.

For all the templates, if a value does not exist, it is replaced with nothing. This could leave two slashes adjacent to one another, which will be replaced by the template processor with one slash. Thus, when using template two when there isn't a series, without you doing anything the template effectively becomes
Code:
template('{#genre}/{#sub_genre}/title}{authors}');
Best I can do with the information I have.
chaley is offline   Reply With Quote