Output splitted on jobsegment with metadata from document

Hi,
I want to split mit output on jobsegment level, based on a metadata field (no problem).
But now I want to add additional text to my banner page with a value from metadata on document level.
In that case I always get an error.
ApplicationException: expression 'document.metadata.MyDataField' at line 1, column 3 in pattern '${document.metadata.MyDataField}' yields undefined
Of course that metadata field exists on document level. I have created it and have selected it via the plus button in additional text.

I understand that it is not easy to handle this, because of multiple documents within one jobsegment, but wonder if there is a possibility.
Maybe that metadata document object (e.g. document.metadata.MyDataField) has an index, so I could use the document metadata?
I have tried the following but also get an error:

${
var docNr = document.sequence.segment - 1;
document.metadata[docNr].MyDataField;
}

My goal is to create a banner page per jobsegment. On that banner page I want to add the content of a data field from the first and the last record/document in the jobsegment.

Is there any way to do that in Connect output?

Thanks,
Thomas

Hello @thomasweber,

It has already been a while ago since you posted your question but did you manage to solve your question in the end?

You should be able to use ${document.metadata.fieldName} in the Text textarea of the Additional Test section of your Output Creation Preset when you are splitting your output on Job Segment based on "fieldName"and have added the field “fieldName” to the Document Tags tab of the Meta Data Options section of your Job Creation Preset or, at least, I was able to do so in version 2023.1 of PReS Connect.