# Use Alternate Field if First Doesn't Exist

**URL:** https://community.mp3tag.de/t/use-alternate-field-if-first-doesnt-exist/63571
**Category:** Mac
**Created:** [January 27, 2024, 12:56pm UTC](https://community.mp3tag.de/t/use-alternate-field-if-first-doesnt-exist/63571 "2024-01-27T12:56:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![josephzitt](https://community.mp3tag.de/user_avatar/community.mp3tag.de/josephzitt/32/9533_2.png) [@josephzitt](https://community.mp3tag.de/u/josephzitt)
#### Post date: [January 27, 2024, 12:56pm UTC](https://community.mp3tag.de/t/use-alternate-field-if-first-doesnt-exist/63571/1 "2024-01-27T12:56:22Z")

</div>

In actions to rename files in Mp3Tag for Mac: Is it possible to code the formula to (in my case) use ALBUMARTISTSORT if the tag exists, but use ALBUMARTIST if it doesn't?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 27, 2024, 12:59pm UTC](https://community.mp3tag.de/t/use-alternate-field-if-first-doesnt-exist/63571/2 "2024-01-27T12:59:49Z")

</div>

See the scripting function

> [@Scripting Functions](https://community.mp3tag.de/t/scripting-functions/51689):
>
> Mp3tag offers various built-in scripting functions, which can be used at various places in the program. These functions offer advanced display and converting options and are to be used in combination with [Format Strings and Available Placeholders](https://community.mp3tag.de/t/format-strings-and-available-placeholders/51688). General Functions Replace $replace(string,from,to) or $replace(string,from1,to1,from2,to2,...) Example: $replace(%title%,\_,-) This example replaces all underscores with dashes. You can provide additional pairs of from/to as parameters. Case Co…

esp. `$if2`.  
`$if2(%albumartistsort%,%albumartist%)`
