Options for "AND" or non-blank in file renaming?
I'm using the following syntax for PDF file renaming
```
{{ if itemType == "journalArticle" }}
{{ publicationTitle suffix=" - " }}{{ year suffix=" - v" }}{{ volume suffix="-" }}{{ issue suffix=" - pp" }}{{ pages suffix=" - " }}{{ firstCreator suffix=" - " }}{{ title truncate="100" }}
{{ elseif itemType == "journalArticle" }}
{{ journalAbbreviation suffix=" - " }}{{ year suffix=" - v" }}{{ volume suffix="-" }}{{ issue suffix=" - pp" }}{{ pages suffix=" - " }}{{ firstCreator suffix=" - " }}{{ title truncate="100" }}
{{ elseif itemType == "book" }}
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
{{ else }}
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
{{ endif }}
```
I'd like to modulate this slightly so that items in the database which have a non-blank entry for the journalAbbreviation field, will swap that in for {{ publicationTitle suffix=" - " }}, e.g. {{ journalAbbreviation suffix=" - " }}.
I'm not really sure how to add these layers as it's not clear what the syntax is for AND in logic statements in zotero. Has anyone else had more luck with this?
```
{{ if itemType == "journalArticle" }}
{{ publicationTitle suffix=" - " }}{{ year suffix=" - v" }}{{ volume suffix="-" }}{{ issue suffix=" - pp" }}{{ pages suffix=" - " }}{{ firstCreator suffix=" - " }}{{ title truncate="100" }}
{{ elseif itemType == "journalArticle" }}
{{ journalAbbreviation suffix=" - " }}{{ year suffix=" - v" }}{{ volume suffix="-" }}{{ issue suffix=" - pp" }}{{ pages suffix=" - " }}{{ firstCreator suffix=" - " }}{{ title truncate="100" }}
{{ elseif itemType == "book" }}
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
{{ else }}
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
{{ endif }}
```
I'd like to modulate this slightly so that items in the database which have a non-blank entry for the journalAbbreviation field, will swap that in for {{ publicationTitle suffix=" - " }}, e.g. {{ journalAbbreviation suffix=" - " }}.
I'm not really sure how to add these layers as it's not clear what the syntax is for AND in logic statements in zotero. Has anyone else had more luck with this?
match
to check the content of one field and then decide to use it or fall back to another. Here is an example wherejournalAbbreviation
is used if present, andpublicationTitle
otherwise:{{ if {{ journalAbbreviation match="^.+$" }} }}
{{ journalAbbreviation }}
{{ else }}
{{ publicationTitle }}
{{ endif }}
{{ if itemType == "journalArticle" }}
{{ if {{ journalAbbreviation match="^.+$" }} }}
{{ journalAbbreviation suffix=" - " }}
{{ else }}
{{ publicationTitle suffix=" - " }}
{{ endif }}{{ year suffix=" - v" }}{{ volume suffix="-" }}{{ issue suffix=" - pp" }}{{ pages suffix=" - " }}{{ firstCreator suffix=" - " }}{{ title truncate="100" }}
{{ elseif itemType == "book" }}
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
{{ else }}
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
{{ endif }}