Is there a possibility to set a condition in job output mask in output creation?
I would like to check the type of the document based on field from metadata document tags and use different metadata document tags to name the file depending on document type.
Using this with an appropriate job preset and separation results in files being named as you see them below:
My data only contains either “CA” or “US” for the Country code that I’m feeding into metadata, but I can leverage that to build a condition to do whatever I want in the output mask. You just build your condition following standard Javascript syntax inside of the ${} wrapper as you see below. Then just remove the extra line breaks to make it fit nicely in the box.
Here I’m using fixed values as my output values from the IF statement, but I could just as easily use metadata values there as well like this, where ABC and XYZ represent different fields in your data:
That said, however, you’ve got very limited space to write this statement and it becomes exceptionally hard to read (and therefore to debug/alter) the more complex it gets.
The better place to do this sort of conditional logic would be back in the datamapper. Create a javascript based extraction that can set a single “documentName” field to a given value based on the values in other fields. Then you pass that field over to your output preset and use it as is.