Page 1 of 1

Help with source template expression

Posted: 09 Jan 2023 21:32
by Peter Collier
I have a date field in a source template called "Publication date". I want to be able to separate the day and month from that field to suit a particular footnote style.

{Publication_date:YEAR} separates out the year for me, and I can get half way there with the day and month by using the expression {=Day(%SOUR.~DT-Publication_date%)} {=Month(%SOUR.~DT-Publication_date%)}. However, {=Month... returns the month number, whereas I want the (full) month name.

I know that is the correct behaviour for =Month. How might I change the expression, so that I get the full month name, rather than just the month number?

In full, the footnote format currently reads:
<{Author}.> <({Publication_date:YEAR})> <'{Article_title}'.> <i>{Publication_title}.</i> < {=Day(%SOUR.~DT-Publication_date%)} {=Month(%SOUR.~DT-Publication_date%)}.> <{Page_and_column}.>

The output, as I want it to appear, would be (for example):
Higginbottom, Josiah. (1880) 'Stealng a Loaf'. Derby Daily Telegraph and Reporter. 12 March. p. 3

Currently, I am getting:
Higginbottom, Josiah. (1880) 'Stealng a Loaf'. Derby Daily Telegraph and Reporter. 12 3. p. 3

Re: Help with source template expression

Posted: 09 Jan 2023 21:47
by tatewise
Instead of using FH Functions, use Date Qualifiers like you are with :YEAR as defined in the Help page Date Formats.
i.e.
{Publication_date:DAY} {Publication_date:MONTH_NAME}

Re: Help with source template expression

Posted: 09 Jan 2023 22:03
by Peter Collier
Unfortunately, that doesn't work. I get the following error message:
Screenshot.jpg
Screenshot.jpg (17.33 KiB) Viewed 316 times
That is what pushed me down the function route.

Re: Help with source template expression

Posted: 09 Jan 2023 22:07
by Peter Collier
I should add, the same error message appears, mutatis mutandis, for the title, bibliography, and short footnote. The error doesn't just appear for the footnote format.

Re: Help with source template expression

Posted: 09 Jan 2023 22:17
by tatewise
Sorry, I'd overlooked that only the :YEAR Qualifier works on Date Field {Name} (for some reason that only CP can explain).
So you must use the Data Reference alternative which does work:
{%SOUR.~DT-Publication_date:DAY%} {%SOUR.~DT-Publication_date:MONTH_NAME%}
which makes explaining why {Publication_date:DAY} {Publication_date:MONTH_NAME} don't work even stranger.
Perhaps you'd like to ask CP :D