Lesson 5: Several document types in one run
A delivery rarely holds one kind of document. In this lesson you check drawings and an A4 report in the same run. Each PDF must be checked by the right document type, and a PDF that fits none of them must show up in the report as such.
What you learn
- What the Document filter of a document type does.
- Filtering by file name with a simple pattern, and filtering by a Validator.
- The document type warnings, such as a filter that matches every PDF.
- What without document type means in a report, and what happens to a PDF that two document types accept.
Files for this lesson
Download Lesson 5 files (zip) and unpack it.
| File | What it is for |
|---|---|
template/NDXTEST-NHX-B1-00-DR-A-200100_P02_A3_landscape.pdf | The template for the document type "Drawing". |
template/NDXTEST-NHX-B1-ZZ-RP-A-000101_P01.pdf | The template for the document type "Report": a two-page A4 report. |
check/NDXTEST-NHX-B1-01-DR-A-200101_P02_A3_landscape.pdf | A file to check. |
check/NDXTEST-NHX-B1-RF-DR-A-200102_P01_A3_landscape.pdf | A file to check. |
check/NDXTEST-NHX-B1-ZZ-RP-A-000101_P01.pdf | A file to check. |
check/NDXTEST-NHX-B1-ZZ-SK-A-200900_P01_A3_landscape.pdf | A file to check. |
Look at the fifth part of each file name: DR for a drawing, RP for a report, SK for a sketch.
The document filter
Every document type has a Document filter. It decides which PDFs belong to the document type. A PDF is checked by every document type whose filter accepts it. That can be one, several, or none.
By file name, the file name must match a pattern; a new document type starts with "1+ characters", which every file name matches. By validator, the PDF belongs to the document type when one of its Validators passes on it, usually a Hidden one. See Document types › The document filter.
What the report shows
- A PDF that no filter accepts is counted under without document type on the Files card. In the Excel export its outcome is NO DOCUMENT TYPE. It is not a pass.
- A PDF that two filters accept is checked by both document types, and gets results from both. When the document types check different things, that usually means a failure on one of them. Make the filters exclusive.
Document type warnings
The warnings button at the top of a document type page lists set-up problems, such as a file name pattern that matches every PDF or a filter Validator that is not hidden. When the document type is set up well, the button disappears. See Document types › Configuration warnings.
Steps
Create two document types
- Create a new project named
Lesson 5. Drop both PDFs from thetemplatefolder on the Doctypes tab at once. NodePDF creates two document types, each named after its file. - Rename the drawing's document type to
Drawingand the report's toReport, with Edit details on each page.
Add one check to each
- On Drawing, add a field validation on the CLIENT box with Exactly "EXAMPLE CLIENT" (as in lesson 1).
- On Report, do the same on the CLIENT field of the report's first page: choose Field validation, click the CLIENT box, and add Exactly "EXAMPLE CLIENT".
See what happens without filters (optional)
- On the Validate tab, choose the four PDFs from the
checkfolder and run a report namedLesson 5 no filters. Every PDF belongs to both document types, because both filters still accept every file name. The drawings are also checked as reports, and the report as a drawing. The CLIENT area of one document type reads the wrong part of the other's pages, so those checks fail.
Set the filters
- Open Drawing. In the Document filter section, choose Edit filter.
- Keep By file name. Build the pattern from three blocks: Any characters, then a Text block
-DR-, then Any characters. - Type a file name under Try a file name, for example
NDXTEST-NHX-B1-ZZ-SK-A-200900_P01_A3_landscape.pdf. It says Doesn't match. The line below says whether the template file matches: it must. - Choose Save.
- Open Report and set its filter the same way, with the Text block
-RP-. - Open the warnings button on each document type page. The warning about a pattern that matches every PDF is gone.
Run the report
- On the Validate tab, run the four PDFs again, named
Lesson 5.
Exercise
Set up the two document types with exclusive file name filters, as in the steps, and run the four PDFs from the check folder.
You're done when…
- each document type page says that its template file matches the filter;
- the report "Lesson 5" shows Files 4, with 1 without document type;
- the Document types card shows 2 with files;
- the Results card shows 3 passed, 0 failed: the two drawings as Drawing and the report as Report;
- the sketch 200900 has no document type (in the Excel export, the Files sheet shows its Outcome as NO DOCUMENT TYPE), because "-SK-" matches neither filter.
NDX Example - Text and drawings filters by validator instead of by file name. "Drawing" has a hidden Page format check named "Not A4", and "Text document" a hidden Page format check named "A4". Every PDF is either A4 or not, so each one goes to exactly one document type. Open each document type's Document filter to see it, and look for the Filter chip in the Items section.