Assemble job based on hierarchy info

Post Reply
User avatar
JimmyHartington
Advanced member
Posts: 282
Joined: Tue Mar 22, 2011 7:38 am

Assemble job based on hierarchy info

Post by JimmyHartington »

I have tried to make a flow, which recieves folders with one level of subfolders which contain PDF-files.

The individual PDF-files are manipulated and the I would like to first merge them to one pdf on sub-folder level. Filename should then be the name of the subfolder.
After this I would like to merge these files based on top-level (Book 02, Book 03).

But I have not successed with finding a way to merge on the top-level.

So now I am submitting a hierarchy and the flow works, but I am missing the step to merge on top-level.
I have tried to assemble job based on hierarchy index 1, but I can not find a way to determine how many files is should be used.

So I hope anyone can give input with some good ideas as to how to do this.

This is the flow as it is now.
Image

And this is the structure of input.

Code: Select all

INPUT
├── Book 02
│   ├── 00
│   │   └── 02.pdf
│   ├── 01 APV Pumpen - SPX - APV
│   │   ├── 01 APV_W+_MANUAL_DE_06_2013.pdf
│   │   ├── 02 APV_W+_SPARE_PARTS_UK_04-2015.pdf
│   │   └── 03 SPX FLOW Declaration of Conformity FCM for W+ Pumps.pdf
│   ├── 02 APV Ventilen, Filter und Flansch - SPX - APV
│   │   ├── 01 APV_RUF3_DE-5_092017.pdf
│   │   ├── 02 APV_SI2_DE-6_012019.pdf
│   │   ├── 03 #DK_UK_FSH_09_2008.pdf
│   │   └── 04 Flanschverbindung FGN1 DN25-150.pdf
│   ├── 03 APV Plattenapparat - SPX - APV
│   │   ├── 01 PHE_Manual_D(Deutsch).pdf
│   │   ├── 02 3243213_10_SN04E09A-1-1A_FINAL DOC.pdf
│   │   └── 03 3243213_90_SN04E09A-2-1A_FINAL DOC.pdf
│   ├── 04 SIHI Pumpen - Armatec
│   │   ├── 01 Betriebsanleitung_Pumpe 26397.pdf
│   │   ├── 02 Datenblatt Kugel-Rückschlagventil XCk_50.pdf
│   │   └── 03 Konformität 21-320553-01.PDF
│   └── 05 Dampf Brüdenverdichter - Koerting
│       └── 01 113-1-13862-1 - MDB - R00 operation.pdf
└── Book 03
    ├── 00
    │   └── 03.pdf
    ├── 06 Bürkert Ventilen - Bürkert
    │   ├── 10 MA2100-Manual-DE-DE.pdf
    │   ├── 20 MA2301-Manual-DE-DE.pdf
    │   ├── 30 MA8690-Manual-DE-DE.pdf
    │   ├── 40 2100 2101 2300 2301 1000248608-0_Element-Sitz_MDec_FoodandBeverage-FDA-EGV1935_de_en.pdf
    │   ├── 50 MA8692-ManualREV.2-DE-DE.pdf
    │   ├── 60 1000190647-C_8692_EU-DoC.pdf
    │   ├── 70 1000218456-C_2100_EU-DoC.pdf
    │   ├── 80 1000219213-E_8690_EU-DoC.pdf
    │   └── 90 1000290509-B_2301_EU-DoC.pdf
    ├── 07 Keofitt Sesame - Fagerberg
    │   ├── 01 Sesame_Manual.pdf
    │   ├── 02 SESAME BODY TYPE P 1_.pdf
    │   ├── 03 SESAME HEAD TYPE H EPDM.pdf
    │   ├── 04 890041E.pdf
    │   ├── 05 QUICK COUPLING W9_WELDING LINER.pdf
    │   ├── 06 3068063_nrp3ACertificateLicenseCONT.pdf
    │   └── Thumbs.db
    └── 08 Kettenzug - Certex
        ├── 10 User Manual Powertex Trolley -DE- (1).pdf
        └── 20 X-CH handtakel^Mblack - DE.pdf
And this is the structure of the output as it is now.

Code: Select all

OUTPUT
├── Book 02
│   ├── 00.pdf
│   ├── 01 APV Pumpen - SPX - APV.pdf
│   ├── 02 APV Ventilen, Filter und Flansch - SPX - APV.pdf
│   ├── 03 APV Plattenapparat - SPX - APV.pdf
│   ├── 04 SIHI Pumpen - Armatec.pdf
│   └── 05 Dampf Brüdenverdichter - Koerting.pdf
└── Book 03
    ├── 00.pdf
    ├── 06 Bürkert Ventilen - Bürkert.pdf
    ├── 07 Keofitt Sesame - Fagerberg.pdf
    └── 08 Kettenzug - Certex.pdf
nna
Member
Posts: 30
Joined: Tue Jul 21, 2020 9:57 am

Re: Assemble job based on hierarchy info

Post by nna »

I had a somewhat similar case the other day. I ended up writing my condition to a Private Data—the size of the PDFs in my case—then set the assembly scheme to "Custom", set the Private Data as the Job identifier and set the number of files quite high and the After N minutes to one. So the flow assembles everything with the same Private Data after one minute. It's neither the most efficient nor the most elegant workflow but it works. Maybe you could try something along these lines?
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Assemble job based on hierarchy info

Post by freddyp »

Instead of using "Ungroup job" at the beginning you should use "Job dismantler" because there you can define a level to which you want to dismantle. The first step would be to dismantle only at the first level, the result being "Book 02" and "Book 03".

Then you dismantle again at the top level giving you a set of folders with the PDFs. Ungroup those folders, process the PDFs and assemble them again as an ungrouped job and merge them.

Then you can assemble the merged PDFs again based on the number of folders you started from: Scheme-Custom with "Number of files" being equal to the number of folders you had after the second dismantle. In order to know that number you can use the "Filetypes counter" app (part of the Folder apps bundle) before the dismantle. Take care: counting the number of folders at the top level does not work correctly with the currently published version of the "Filetypes counter" app. We have a Node.js version in test and there it works correctly, so I suggest you sign up for testing the bundle as described here: viewtopic.php?f=23&t=4313

What you will also need is "Delete files" (also from the Folder apps bundle) to get rid of Thumbs.db, otherwise the assembly will not work correctly because PitStop Server will reject the file and you will be one short. Do that at the beginning of the flow.
User avatar
JimmyHartington
Advanced member
Posts: 282
Joined: Tue Mar 22, 2011 7:38 am

Re: Assemble job based on hierarchy info

Post by JimmyHartington »

Thanks Freddy.

Forgot about the Job Dismantler.

I think I can make it work with your suggestions.
User avatar
JimmyHartington
Advanced member
Posts: 282
Joined: Tue Mar 22, 2011 7:38 am

Re: Assemble job based on hierarchy info

Post by JimmyHartington »

I have now got it to work with Freddy’s suggestion.

I used the current Filetypes Counter on level 2.

Image
Post Reply