View Single Post
Old 06-02-2015, 09:39 AM   #2
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You need a way to insert a separator (comma or slash) if both items have values. One way to do that is to treat them as lists each with zero or one value then merge the lists. The separator will be added if there are two values.

The following general program mode template is an example for your column that holds the indices.
Code:
program:
	a = template('{series} {series_index}');
	b = template('{#series} {#series_index}');
	re(list_union(a, b, '%%%'), '%%%', ' / ')
For the columns that hold just the title would look something like the following:
Code:
program:
	a = field('series');
	b = field('#series');
	re(list_union(a, b, '%%%'), '%%%', ', ')
Edit: change the list separator to ensure that there are no accidental occurrences in the values, such as a series name containing a comma. Also use 'field' instead of 'template' in the second example to improve performance.

Last edited by chaley; 06-02-2015 at 12:04 PM. Reason: improvements to template
chaley is offline   Reply With Quote