Help with If statement

Started by stefanjan2, May 06, 2024, 02:40:07 PM

Previous topic - Next topic

stefanjan2

I'm trying to figure out the syntax to check whether the date I took photo is the same as current year.

Something like this {File.DateTime|format:YYYY|is:Application.DateTime|format:YYYY,Current Year,Prior Year}

Can anyone help me with the correct syntax and where I can find further documentation. I have studied "Variables" help.

Mario

Your syntax is slightly off:

1 .The | is only used before the first formatting function. All other functions following that are separated using ;
2. If you nest other variables, these must be included in { and }, which you forgot for the Application.DateTime variable.

Changing your variable to

{File.DateTime|format:YYYY;is:{Application.DateTime;format:YYYY},Current Year,Prior Year}

should work. Note that all files not from the current year will show as "Prior Year", even if they are a decade old!

Tip: You could use something like

{File.DateTime|format:YYYY;math:sub,{Application.DateTime|format:YYYY}}

to get the difference in years between the two variable values.
File: 2024, today: 2024 => 0
File: 2023, today: 2024 => -1
File: 2020, today: 2024 => -4
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

stefanjan2

Thanks for your help
Quote{File.DateTime|format:YYYY;is:{Application.DateTime;format:YYYY},Current Year,Prior Year}
Your example did not work, it resulted in Prior Year for all files but adding a second | instead of ; did work.
{File.DateTime|format:YYYY;is:{Application.DateTime|format:YYYY},Current Year,Prior Year}
QuoteThe | is only used before the first formatting function. All other functions following that are separated using ;
I replaced the ; with a second |. This code is new to me, is this imatch proprietary code or is  it named code so I can search for documentation?
QuoteNote that all files not from the current year will show as "Prior Year", even if they are a decade old!
Appreciate that, I'm using renamer to move current year files to an SSD older files to a spinning drive.

sinus

I think, this is code only for IMatch, but I do not know this for sure.
But in the IMatch-help about variables there are really a lot of information, very precise and with examples.
If you work with variables, it is for sure very helpful.

Not exactly your topic, but about something like this there was a thread
https://www.photools.com/community/index.php/topic,13975.msg98392.html#msg98392 
Best wishes from Switzerland! :-)
Markus

Mario

Sorry, copied & pasted the wrong row from my tests.
The second variable {Application.DateTime|format:YYYY} of course must use a | not a ; - because it's a new variable and the first formatting function for that variable.

{File.DateTime|format:YYYY;is:{Application.DateTime|format:YYYY},Current Year,Prior Year}

All that's to know about variables is here.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook