Help with formatting own style

Please help, formatting experts!

Trying to get short form citations to work…

The following command works fine:

(Author|, Year|, Cited Pages|)

With this, whenever the “cited pages” field is empty, the “Year” will be followed immediately by the final closing bracket

However, the following does not work the same way:

Author|, Year|, Cited Pages|.

All I have done is remove the ( ) and use a full stop at the end. Yet now, when the “cited pages” field is empty, I get a comma and a space before the final punctuation!

Why is it behaving like this?

thanks for your help

Try replacing the spaces with “link adjacent” from the insert field drop down, except for the one in the “Cited Pages” field itself.  

P.S. you can deleted the other 2 duplicate requests from their Options drop down, as long as no one replies to them!