@stepan-ozana Hi Stepan,
Thank you for your question. It is possible to set the start of task execution as soon as the previous task ends. More details in TASK documentation: https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/TASK.html#x26-250002
Information between tasks should be always sent via Inports and Outports if possible (SETPx function blocks can introduce undesired inverse of priorities when sending data between tasks).
Second part - "on demand" execution:
Thanks for sharing your solution! It is also possible to use SRTF function block (Set run-time flags):
Doc: https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/SRTF.html#x21-200002
If you need any assistance just let me know.
Cheers,
Tomas