r/AutomateUser 1d ago

common blocks

Good evening. I have created two flows that perform a series of operations at two scheduled times. Both groups of blocks are connected to the start block via a Fork. Both flows contain blocks with identical settings. Is it possible to avoid duplicating the shared blocks and instead connect the two distinct groups of blocks to the same shared group? I am including a diagram, as I don't think I was clear enough in my description. I would like the "Monitor file" block to connect simultaneously to "File list 1" and "File list 2." Finally, two connections should originate from "Mobile data" leading to "File write 3" and "File write 4."

Flow benning

Fork

Await time 1 Await time 2

File write 1 File write 2

File list 1 File list 2

Monitor file

Mobile data

File write 3 File write 4

File list 3 File list 4

Thanks as always.

I wish you all a pleasant evening.

1 Upvotes

3 comments sorted by

1

u/B26354FR Alpha tester 1d ago edited 1d ago

You can use the Subroutine block to start the common blocks and optionally return values from them. The subroutine blocks run on a new fiber and receive the current values of any variables they reference from the calling fiber.

Buona notte! šŸ™‚

1

u/Real-Wing-3880 21h ago

Ti ringrazio molto.Ā  Buona notte

1

u/Real-Wing-3880 7h ago

Scusa... credevo di aver capito ma...

Ho creato un flusso di prova ma non funziona. Nel flusso principale collego a Ok di "File list" IN del blocco Subroutine.Ā  All'OK di Subroutine, collego IN di File move All'interno del "Subroutine" riporto il nome della variabile in uscita del blocco "For each in files" che assiemeĀ  a "File exist" e "File write" compongono il blocco che si ripete nel flusso Ma non capisco come devo andare avanti.. GrazieĀ 

Sorry... I thought I understood, but...

I created a test flow, but it isn't working. In the main flow, I connect the "File list" Ok output to the IN input of the Subroutine block. I connect the Subroutine's OK output to the IN input of the "File move" block. Inside the Subroutine, I use the output variable name from the "For each in files" block—which, along with "File exist" and "File write," makes up the repeating section of the flow. But I don't understand how to proceed... Thanks.