# How Set Date to Minimum of \_recording\_firstreleasedate and originaldate?

**URL:** https://community.metabrainz.org/t/how-set-date-to-minimum-of-recording-firstreleasedate-and-originaldate/585648
**Category:** MusicBrainz Picard
**Tags:** taggerscript, picard
**Created:** [May 18, 2022, 5:36pm UTC](https://community.metabrainz.org/t/how-set-date-to-minimum-of-recording-firstreleasedate-and-originaldate/585648 "2022-05-18T17:36:04Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)
#### Post date: [May 18, 2022, 5:56pm UTC](https://community.metabrainz.org/t/how-set-date-to-minimum-of-recording-firstreleasedate-and-originaldate/585648/2 "2022-05-18T17:56:46Z")

</div>

About the script error: there is a missing `$` in front of the `if`.

And yes, if a value is empty `$lt` would consider it smaller. But maybe combine it with an `$if2`, which takes the first non empty value:

```taggerscript
$set(date,$if2($if($lt(%_recording_firstreleasedate%,%originaldate%),%_recording_firstreleasedate%,%originaldate%),%_recording_firstreleasedate%,%originaldate%,%date%))

```

_I hope I got this right, did not test it and wrote it on my mobile 😉_

But this is supposed to use your condition of the smaller value, but if that turns out to be empty falls back to the first non-empty value.

---

_[View the full topic](https://community.metabrainz.org/t/how-set-date-to-minimum-of-recording-firstreleasedate-and-originaldate/585648)._
