Author Topic: Variable: Quarter (of year)  (Read 6198 times)

Offline TGeist

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • GG-IMAGES :: Charlotte Wedding Photographer
Variable: Quarter (of year)
« on: January 08, 2019, 11:32:42 PM »
Among the plethora of useful date variables, can we also have one for the quarter of the year?

In an array of dated folders or files a subdivision into annual quarters can help minimizing the clutter.

Thank you!
Thomas

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Variable: Quarter (of year)
« Reply #1 on: January 09, 2019, 07:59:21 AM »
Thomas,

Among the plethora of useful date variables, can we also have one for the quarter of the year?

In an array of dated folders or files a subdivision into annual quarters can help minimizing the clutter.

What would be the output of such a variable?  Q1, Q2, Q3, Q4?

-Kirk

Offline TGeist

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • GG-IMAGES :: Charlotte Wedding Photographer
Re: Variable: Quarter (of year)
« Reply #2 on: January 15, 2019, 01:20:38 AM »
Just the number might be even more flexible. One can always put the Q in front of it: something like Q{quarter}.

This would also be better for other languages that might not have a word starting with a Q for quarter.
I am always pleasantly amazed by PM's power of variables!

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Variable: Quarter (of year)
« Reply #3 on: January 15, 2019, 03:16:18 AM »
How about creating a code replacement for the month variable that turns it into the quarter? That would allow you to make use of the “quarter” right now :)
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline TGeist

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • GG-IMAGES :: Charlotte Wedding Photographer
Re: Variable: Quarter (of year)
« Reply #4 on: January 16, 2019, 10:23:16 PM »
Interesting!

Now I need to find out how code replacements work ...  ;)

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.

Offline TGeist

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • GG-IMAGES :: Charlotte Wedding Photographer
Re: Variable: Quarter (of year)
« Reply #6 on: January 21, 2019, 10:03:40 AM »
Concerning the code replacement that would mean that I'd lose the moth variable however.

A string like

{year4}-{quarter}/{year4}-{month0}-{day0}

could not be generated via a code replacement where months are replaced by the respective quarter's number.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Variable: Quarter (of year)
« Reply #7 on: January 21, 2019, 10:06:56 AM »
Concerning the code replacement that would mean that I'd lose the moth variable however.

A string like

{year4}-{quarter}/{year4}-{month0}-{day0}

could not be generated via a code replacement where months are replaced by the respective quarter's number.

No.  You're not using Code Replacement in that example.  You've invented a new variable that doesn't exist (it won't output anything).

It needs to be like this:

{year4}-={year4}=/{year4}-{month0}-{day0}

-Kirk

Offline TGeist

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • GG-IMAGES :: Charlotte Wedding Photographer
Re: Variable: Quarter (of year)
« Reply #8 on: February 16, 2019, 07:22:51 AM »
Quote
No.  You're not using Code Replacement in that example.  You've invented a new variable that doesn't exist (it won't output anything).

It needs to be like this:

{year4}-={year4}=/{year4}-{month0}-{day0}

-Kirk

Sorry, I lost track of this for a while.
I actually didn't explain what I meant with the phrase {year4}-{quarter}/{year4}-{month0}-{day0}


I wanted to show my desired result. Something like

2019-Q1/2019-02-16

for today's date would have been the result I'd like to achieve. So of course the variable {quarter} does not exist (yet ;))

But generally I couldn't find a way to have the varying results from the {month0} variable in the Code column of a code replacement file.
The second column (Replacement column) is easy. It would be
1
1
1
2
2
2
3
3
3
4
4
4
with a tab in front of each value. But what would go in the Code column?
Wouldn't that rather require something like a formula like

IF {month0} is between 1 and 3 THEN the result is 1
IF {month0} is between 4 and 6 THEN the result is 2

and so on.

Code replacement can't do this though, right?

Anyway, thank you for your help so far!!
Thomas

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Variable: Quarter (of year)
« Reply #9 on: February 16, 2019, 09:25:55 AM »
The first column should simply be the numbers 1 to twelve. To then get the quarter you’d use \{month}\ in eg the iptc stationary pad or info screen (assuming the backslash is your code replacement delimiter).

Does this help the use of code replacements?
« Last Edit: February 16, 2019, 09:27:48 AM by Hayo Baan »
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline TGeist

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • GG-IMAGES :: Charlotte Wedding Photographer
Re: Variable: Quarter (of year)
« Reply #10 on: February 19, 2019, 12:53:11 PM »
That worked! Thank you!!