View Single Post
Old 06-09-2024, 12:33 PM   #1005
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,478
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by maddz View Post
What it's doing is if there are entries in all 3 fields is producing the output:
'Subseries' 'Subseries Index' - 'My Shelves' 'Hugo Nominations'

What I want it to do is produce:
'Subseries' 'Subseries Index' - 'My Shelves' - 'Hugo Nominations'

Ideally, it should be:
'Subseries' 'Subseries Index'
'My Shelves'
'Hugo Nominations'

But I am not sure if the subtitle field can take more than one line...

If there is less than three entries (every title will have 'My Shelves'), the line breaks for the subseries and Hugos should be suppressed, so there is either 1 line or 2 lines:

'My Shelves'

or

'Subseries' Subseries Index'
'My Shelves'

or

'My Shelves'
'Hugo Nominations'
Putting aside the newlines, this template does what the above says you want. There might be some misspellings in the column lookup names as I don't have those columns in my database.
Code:
{#subseries}{#subseries_index:| | - }{#myshelves}{#hugonominees:| - |}
I tested it with columns I have:
Code:
{#series}{#series_index:| | - }{#genre}{tags:| - |}
EDIT: According to this post I tested newlines in the subtitle and they didn't work. The the template below isn't useful.

This GPM template does the same thing except for using newlines instead of the minus signs.
Code:
program:
# This template produces a 1-to-3 line result.
# The first line is the subseries if there is one.
# The next line is the shelves, which are always present.
# The last line is the hugo nominees, if there is one.

	if $subseries then
		ss = $#subseries & ' ' & $#subseries_index & character('newline')
	else
		ss = ''
	fi;

	if $#hugonominees then
		hugo = character('newline') & $#hugonominees
	else
		hugo = ''
	fi;

	return ss & $#myshelves & hugo
NB: I left off some of the '#' characters in the template in my last post. I tested it with columns that exist then incorrectly edited it to reference your columns.

Last edited by chaley; 06-09-2024 at 12:38 PM.
chaley is offline   Reply With Quote