Defining Variable for Archive Hierarchy

Post Reply
RunDontStop
Member
Posts: 51
Joined: Mon Apr 05, 2021 8:03 pm

Defining Variable for Archive Hierarchy

Post by RunDontStop »

This is a simple question I hope. You cannot define variables for a path using the Archive Hierarchy flow element.

I am on a Mac. When writing files to a network volume, the path always begins as:

/Volumes

I came up with a way to include variables with Archive Hierarchy. The element uses the path as described above.

Before the Archive Hierarchy, I assign variables in Set Hierarchy Path.

This seems to work well. My files go to the correct destination.

My question is: what is wrong with doing this, if anything? I don't see any issues, but that doesn't make this flow structure a good idea.

To further test, I set up a flow where the network volume did not exist. As expected, the job went into the problem jobs folder. It didn't cause a major problem or a system crash.

I am hesitant to move forward with this solution, because Archive Hierarchy does NOT have the define variables option, and so there must be some reason.

Consider the path:

/Volumes/Jobs

Jobs, as seen on the Mac, is not a folder, it is a mounted network volume. When using Archive Hierarchy, Switch normally creates any folders in the path that are not already there.

So if Archive Hierarchy path is:

/Volumes

And you have a private data tag "TOP", defined as "Jobs"

Set Hierarchy preceding Archive Hierarchy uses the variable "{Job.PrivateData:Key="TOP"]

When the job reaches the Archive Hierarchy element, Switch is attempting to write the file to:

/Volumes/Jobs

If the network volume "Jobs" is mounted, the file goes on into "Jobs" with no issue.

If "Jobs" is not mounted on the Mac, Switch cannot create a folder on the level "/Volumes" and so the job goes into Problem Jobs, which is good.

Any problems with what I have described?
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Defining Variable for Archive Hierarchy

Post by JimmyHartington »

As I understand the use of the Archive Hierarchy, you need to set the basepath.
Jobs will then be archived with the hierarychy set on the job. Either a hiearchy set in the processing of the flow, from input or with the Set Hierarchy Path.
So in your case you should probably set the base folder in Path to "/Volumes/Jobs".
You can the use other mechanism in Switch to create your hierarchy.
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Defining Variable for Archive Hierarchy

Post by JimmyHartington »

Here is an example from a flow, where I use the hierachy information to build a custom hiearchy.

On the folder images (and the other orange folders under it) I have set "Attach hierarchy info" to Yes.
Image

And with "Set hierachy path" I use a variable (in this case private data) to set the top of the hierachy.

Image

And with the base folder of "Archive hierarchy" set to path "/Volumes/Jobs" I get this hiearchy of images downloaded by the flow.

Code: Select all

/Volumes/Jobs
├── SKU-ABC_
│   └── images
│       ├── IMG_5035.jpg
│       ├── IMG_5042.jpg
│       ├── IMG_5043.jpg
│       └── IMG_5046.jpg
└── SKU-DEF_
    └── images
        ├── IMG_4501.jpeg
        ├── IMG_4502.jpeg
        └── Image.jpeg
Post Reply