To turn this monstrosity
col2:=IFS(!IS_BLANK($DateReleased:),$DateReleased:,!IS_BLANK($DateEncoded:),FORMAT_DATETIME($DateEncoded:),!IS_BLANK($DateTaken:),FORMAT_DATETIME($DateTaken:),!IS_BLANK(GETPROPERTY($FullPath:,"Recorded date")),GET_PROPERTY($FullPath:,"Recorded date"),!IS_BLANK($Date:),FORMAT_DATETIME($Date:),1,$DateModified:)
Into:
col2:=COALESCE($DateReleased:,FORMAT_DATETIME($DateEncoded:),FORMAT_DATETIME($DateTaken:),GET_PROPERTY($FullPath:,"RecordedDate"),FORMAT_DATETIME($Date:),1,FORMAT_DATETIME($DateModified:))
Or:
col2:=COALESCE($DateReleased:,GET_PROPERTY($FullPath:,"Recorded date"),FORMAT_DATETIME(COALESCE($DateEncoded:,$DateTaken:,$Date:,$DateModified:)))
- By GET_PROPERTY($FullPath:,"Recorded date") I was trying to get at a non-canonical property that shows up in MediaInfo that I later found to be in QuickTime Metadata. Then noticed that appears to be where $DateReleased: is actually already sourcing the value from.
- $DateReleased: is a string value that sometimes is just the Year or some other oddly formatted date string Everything can't parse and format. In that case, I just want the raw string.
- All other values appear to be numbers. COALESCE() should omit null-ish [sup]or should I say, void-ish[/sup] & invalid values.
Essentially want to do something like the following (powershell syntax):
Code: Select all
$col2 = @($DateReleased, $DateEncoded, $DateTaken, $Date, $DateModified) `
| where { ($_ -is [number]) { $_ -gt 0 } else { -not [string]::IsNullOrWhiteSpace($_) } } `
| select -First 1 { if ($_ -is [number]) { $_ -as [datetime] } else { $_ } };$_:In Everything Syntax, I think it'd look something like:
FORMAT_DATETIME(WHERE(GREATER(TIMEVALUE($_:),0),$DateReleased:,$DateEncoded:,$DateTaken:,$Date:,$DateModified:))
* WHERE(condition,value1,value2,...)
Essentially COALESCE, but you can specify the condition.