Page 1 of 1

Assemble Job with no delay

Posted: Wed Jun 21, 2017 6:22 am
by cwswitch
Hi,

I have a flow that is really a glorified hotfolder to the end user. They drag in a bunch of PDFs and the flow merges and processes them. There is then no XML, just PDFs flowing through.

I have to use the Assemble Job tool and it demands some kind of scheme. The best option I've found so far is to have the scheme After N minutes = 1, but I do not truly want any delay whatsoever.

I note that I cannot set this value to zero.

How can I please have this Assemble Job tool but not have to wait for an output. Note that there is nothing in the filenames or anything else I can think of to use as a filter, it really is just "whatever the user drops in.. deal with now".

Re: Assemble Job with no delay

Posted: Wed Jun 21, 2017 10:01 am
by sander
I once came up with this for the same situation, in my beginning Switch days tho :)

You throw in a file or folder, in case of a folder it's ungrouped and after it's assembled with that same ungrouped privatekey, which results in no unnecessary waiting.

Image

Re: Assemble Job with no delay

Posted: Thu Jun 22, 2017 2:48 am
by cwswitch
Firstly thanks!

but...

Code: Select all

MergeTool error: Job is not a folder


Does not work - Uses Ungroup and Assemble based on private data ungroup..
Image
Image
http://imgur.com/a/dNhyl

Works, but has a delay of 1 minute - it uses "After N minutes = 1"
Image
Image
http://imgur.com/a/GJLPT

Re: Assemble Job with no delay

Posted: Thu Jun 22, 2017 11:21 am
by TheCaptain
I feel like I'm missing some minute of your Flow but could you set the Assemble to :
Screen Shot 2017-06-22 at 10.19.41.png
Screen Shot 2017-06-22 at 10.19.41.png (52.05 KiB) Viewed 11580 times
Or whatever the Private data key is. Where are you having to set the time to 1?

This feels like an error in your setup for assembly or merge.

Re: Assemble Job with no delay

Posted: Thu Jun 22, 2017 12:09 pm
by sander
How do you submit the pdf's? You can't drop some of 'em in the root input folder, it needs to be in a folder else it doesn't know these belong to each other.

Re: Assemble Job with no delay

Posted: Fri Jun 23, 2017 12:37 am
by cwswitch
TheCaptain - yes, I tried the settings like that - assume issue may be as Sander raised that I'm dropping in PDFs.

Sander - yes, was really hoping to have the user drop PDF files in and have the flow merge whatever came along.

If I put the files in a folder and drop that in, I get the same error from the merge tool "job is not a folder"

Re: Assemble Job with no delay

Posted: Fri Jun 23, 2017 10:04 am
by sander
If a user can just drop files how do you know which files belong to a specific merge job then?

Hm, compare settings to my flow to find out!

https://we.tl/abUHAI2VdX

Re: Assemble Job with no delay

Posted: Tue Jun 27, 2017 12:53 am
by cwswitch
What I really want is for any files dropped in to be merged. It seems this is not best practice, but is what I need in this case.

If I use the 1 minute delay, this works. If I use the Ungroup method, it does not work. So I have a working solution, I just have to wait longer than I'd like.

I'm a little confused as to why the Merge tool requires input the way it does. I'm also unclear on why the Assemble Job tool can assemble just fine with a 1 minute delay, but not with no delay.

Re: Assemble Job with no delay

Posted: Wed Jul 12, 2017 11:53 am
by sander
Morning,

I was working on something else and, don't ask why, this topic popped up in my head.

How about such a thing? It's fast written code but should get you started.

It just reads the content of a directory and pushes all files to a folder which you can use with Merge PDF.

Just correctly set your timer interval and be sure to instruct the users who use it to not dump if the directory is not empty. It can be done each few seconds on my system but I bet that depends on your needs.

Hope it helps,

Code: Select all

// Is invoked at regular intervals regardless of whether a new job arrived or not.
// The interval can be modified with s.setTimerInterval().
function timerFired( s : Switch )
{
	var timer = s.getPropertyValue("Timer");
	var interval = parseInt(timer);	
	s.setTimerInterval(60);
		
		var sourceDir = new Dir("d:\\zooi\\dir");
		var files	= sourceDir.entryList("*", sourceDir.Files, sourceDir.Name);
		var folderPath = s.createPathWithName("pdf", true);
		var job = s.createNewJob();
		
         for (var i=0; i<files.length; i++) {
			 s.log(3, "d:\\zooi\\dir"+files[i]);
			 s.copy("d:\\zooi\\dir\\"+files[i], folderPath+'\\'+files[i]);

			}
		job.sendToSingle(folderPath, "mergeMe"); // Succes ยป out
}