There are several errors.
- The word "program:" is valid only at the beginning of a GPM template. You are using TPM so you don't need 'program'.
- You are missing the closing 'fi' for the 'if'.
- The raw_field() function returns 'None' for an undefined field. Because of that, comparing against the string "0" won't work. Numeric comparisons do work because the recognize "None" and change it internally to zero.
Here is a corrected version of your template, indented so I could read it.
Code:
{series:'
test($,
strcat(
"<i>",
$,
"</i>",
if raw_field("formatted_series_index") ==# 0
then ""
else raw_field("formatted_series_index")
fi,
"<br>"),
"")'}
{#version:'test($, strcat("<b>", $, "</b>"),"")'}
Personally, I would use TPM for something this complicated. For example:
Code:
program:
if $series then
if $$#formatted_series_index ==# 0 then
dex = ""
else
dex = $$#formatted_series_index
fi;
s = strcat("<i>", $series, "</i>", dex, "<br>")
else
s = ''
fi;
if $#version
then
v = strcat("<b>", $#version, "</b>")
else
v = ''
fi;
strcat(s, v)
I strongly suspect that you need a space after the > in "</i>"