call a (sub) flow and read back result

Post Reply
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

Hi,

I am not sure whether this is possible but I thought to built some so-called service flows which take files from different flows (via user-managed folder) do some work on them and then hand them back to the calling flow.

Unfortunately, I do not know how to tell the flows to take only files they have injected into the sub-flow.

Is this possible?



Thank you,



Ariel
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

I think I found out how to do it:

1. Before submitting to the sub-flow I am adding private data tag (flowID) with the name of the flow to the job.

2. When fetching the result I am checking (via the connection) whether the private data tag equals "my" flow.



The problem is that currently something is avoiding the file to go through the "jobs arrived" script I wrote to set the private data tag.

No erro message - strange.
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

stupid me!!!

job.sendToSingle(job.getPath()) made the trick.

BTW, flowID must receive a unique identifier (flow name is not sufficient)
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

call a (sub) flow and read back result

Post by gabrielp »

I wish there was a better/easier way to use flows as functions so you could call out to them within Switch. I know you can assemble and compress them, then uncompress them and pass them into shared hotfolders but it could be much more elegant.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

found a much easier way:

sub routine:

you need a not-managed folder in and a not-managed folder out (do not strip prefix)



calling flow: before sending to in folder (above) add a private data tag (I called it flowID) and populate it with: s.flowname+"_"+job.getUniquePrefix



in the same flow create a receiving folder for the output of the subflow pointing at the OUT folder.

connect it directly to a package (allowFlowID) which only allows passing (sendtosinglepath) if and only if the flowid equals the s.getFlowName+"_+job.getUniquePrefix



That makes the trick I think



Someone is working on the server - I will send you the flows when I get access to.
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

how can I put the flows here?
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

call a (sub) flow and read back result

Post by gabrielp »

ArielRauch wrote: how can I put the flows here?
You can export them and put them on GitHub. That's what I've been doing.



Otherwise you can probably host them at any generic file host and just post the link here. You can submit a flow to Enfocus but it takes a few days to get approved.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

@Gabriel: tell me what you think:

https://github.com/ArielRauch/Enfocus-Switch.git
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

call a (sub) flow and read back result

Post by gabrielp »

ArielRauch wrote: @Gabriel: tell me what you think:

https://github.com/ArielRauch/Enfocus-Switch.git


Ah, that is a much simpler way of handling it than I thought. I didn't think it would keep the metadata/private data like that between flows but I guess I was wrong. Thanks for sharing!
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

call a (sub) flow and read back result

Post by ArielRauch »

I will add multi-level support and share - I hate testing by my own:)
Post Reply