INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: SOLVED - How to convert a date to a string (year only)  (Read 516 times)

FenceFurniture

  • Galactic Citizen
  • ****
  • Posts: 420
SOLVED - How to convert a date to a string (year only)
« on: October 14, 2021, 03:03:03 am »

I thought I was going to have to post this as a question, but having figured it out, I thought it may be useful to someone else who searches for the same thing.

With some classical albums there may be a range of years of the performances/recordings. Vladimir Horowitz plays Chopin is an example (1963-89).

I like to have the albums grouped in the view with the title as
"♫ Chopin: Vladimir Horowitz plays Chopin 16–44 performed by Vladimir Horowitz ~ Piano in 1963-89"     (the 16–44 is the resolution of the album)

with all the tracks listed under that. The ♫ symbol (Alt 14) indicates to me that it is an album of various Chopin works (usually part-works) by the performer (a mixed bag, as it were). There are redundancies in that title, but in a case like this it can't be avoided without major re-coding, and I can handle it the way it is!  8)

If I use the Performance field (my own tag, as the year of perf, Not Relational - one per file, date format) it breaks the grouping up into as many listings as there are years, and may well upset the track order too. Complete works are classified separately, in my system.

This will never do!

So, I created a "Perf. Yr" tag (String, not relational), and displayed that in the view. Then, to convert the Performance to a string which can then be edited, enter the expression:
=formatdate(convertdate([Performed]), yyyy)
into that tag for each file on the album, and it brings up a range of 1965, 1971, 1989 etc.
Select all the tracks and manually edit the Perf. Yr tag to "1963–89"

All that was left to do then was change the expression for the grouping tag from:
[Album] [REZ] performed by [Artist] in [Performed]
to:
[Album] [REZ] performed by [Artist] in If(!IsEmpty([Perf. Yr]), [Perf. Yr], [Performed])
(which gives the title line above in line 4 of this post)

which will pick up "Perf. Yr" if it has a value, or "Performance" if not. (I didn't want to create a Perf. Yr for every album – there is manual work to do entering the expression – because the vast majority are all recorded in one session, or generally within a year). This is only for a small handful of albums, in my case.
Logged
Pages: [1]   Go Up