this works great too!! so the [brackets] are a conditional to only display if the tag is present? i tested it with:
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)| [%discnumber%.][%tracknumber%] - %title%
Yes, that's what the square brackets notation does, but what I meant to underline is that you can put the branching notation "|" inside the conditional statement. You can create a node for the disc number, in between the album node and the track node, and display it only if you have multiple discs.
Given the %discnumber% field is empty for single disc albums, your code above would be:
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)[|disc %discnumber%]|[%tracknumber% - ]%title%
Whether this will work for you depends on your tagging scheme. If the %discnumber% tag is always present, using @j7n suggested expression, you could try:
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)$ifgreater(%totaldiscs%,1,[|disc %discnumber%],)|[%tracknumber% - ]%title%