saving pdf using metadata

The task to perform is as follows:
Input data = a PDF
make a filename
put filename on document
save document using filename

So far i have done the following:

in datamapper add an extract step using javascript
fieldname = filename
script =
var result = ‘1234.pdf’;
result;

In designer:
added @filename@ on top of the page
replace text @filename@ with field filename
the preview now shows 1234.pdf

made a job creation preset
check box include metadata
made a document tag with
tagname = xyz
sourcetype = field
source = filename

made an output creation preset
model = generic pdf
type = directory
output mask = ${document.metadata[‘xyz’]}

When i make a print in designer using both presets i keep getting the error:
invalid expression ‘document.metadata.[‘xyz’]’ at line 1, column 3 in pattern ‘${document.metadata.[‘xyz’]}’

must be doing somthing wrong, any ideas

Hi Gert Schievink ,

${document.metadata[‘xyz’]} should be ${document.metadata.tagname}.pdf. And be sure to select Separation in the output presets print options page. Then in Separation Option page select Document next to Separation under Separation Settings.

Regards,

S

Thanks, that did the trick