View Single Post
Old 09-17-2018, 06:49 AM   #14
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,166
Karma: 1410083
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Not sure if I get your request correct. a example could help for each variant

When you need more differentiation than less, equal, greater then the function switch() is maybe more suitable for your task. Something like:

Code:
program: 
tmp0 = template('No Crossovers/{author}/{title} ({#story_id})');
tmp1 = template('{#fandom_main:sublist(0,2,\,)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');
tmp2 = template('Crossovers/{#fandom_main:sublist(0,2,\,)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');
tmp3 = template('Multiple Crossovers/{author}/{title} ({#story_id})');

## old version check if count is lt, eq,gr
#	cmp(
#		count(
#			field('#fandom_main'), 
#			','), 
#		3, 
#		tmp1, 
#		tmp2, 
#		tmp2);

## new version as "case of count =x"
switch(
		count(field('#fandom_main'), ','),
				0, tmp0,
				1, tmp1,
				2, tmp2,
				3, tmp3,
				tmp3);
# in first position of a line means it is a comment, you can delete them if you want. The mechanism works like "if count = 0 use template 0, if count = 1 use template 1 up to count =3 and if count different to 0,1,2,3 use template 3 (or what ever else you want to do


Regarding the '-', you can use as well |-|, || or |-|- for a prefix and/or suffix
Divingduck is offline   Reply With Quote