# Autostop diagram

**URL:** <https://forum.rtmaps.com/t/autostop-diagram/66>\
**Category:** General\
**Tags:** how-to\
**Created:** [April 11, 2024, 1:14pm UTC](https://forum.rtmaps.com/t/autostop-diagram/66 "2024-04-11T13:14:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Teo](https://forum.rtmaps.com/user_avatar/forum.rtmaps.com/teo/32/10_2.png) [@Teo](https://forum.rtmaps.com/u/Teo)\
**Post date:** [April 11, 2024, 1:46pm UTC](https://forum.rtmaps.com/t/autostop-diagram/66/2 "2024-04-11T13:46:41Z")

</div>

Hello,

Yes, you can dynamically start/stop any diagram.

To monitor the sample rate (i.e if data is received) you can use the component **Sample Rate**  
To autostop a diagram, you need the component **Condition**

![image](https://forum.rtmaps.com/uploads/default/original/1X/a49bb0dd5b18dbcce7bf0fa194c5cf5b514be798.png)

In its initial state, the Condition does not have any input.  
Simply define a condition in its Condition property.

In this case, I want to act if I detect a sample rate inferior or equal to 0  
This is done by setting the Condition property like this :  
 ![image](https://forum.rtmaps.com/uploads/default/original/1X/599fbc4787e8f44273208411248d5634289bdf3f.png)

This will create the **Condition** ’s input sample\_rate.  
I could have named it _a_, _my\_input_ or whatever but I like clear variables name.

The other important property is “Parse when True”  
This is the command that will be called when the condition is true.  
_For more details on how the Condition component works right-click on it → help_  
In this example, I simply want to stop the diagram, the corresponding command is **shutdown**

Here is an example diagram, while the diagram is running right-click on the generator to disable it thus dropping the sample rate to 0.  
The **Condition** will then send the shutdown command to the engine.

[shutdown\_if\_no\_data.rtd](https://forum.rtmaps.com/uploads/short-url/bhL8WIuzpSj0PLPDGNHN0jhgSMS.rtd) (9.4 KB)

For more details on how-to use the Parse scripting language :

> [@Scripting RTMaps Tips and Tricks](https://forum.rtmaps.com/t/scripting-rtmaps-tips-and-tricks/67):
>
> Most actions performed in RTMaps Studio are actually script commands generated by the Studio and sent to the RTMaps Engine. This scripting language is called Parse and you can use it too ! The Parse commands generated by the Studio are printed in black text in the Console view. For example, if place on my diagram a generator, a data viewer and connect both, I get those lines in black in the console : Randint Randint\_2 DataViewer DataViewer\_1 Randint\_2.outputIntegerVector -\> DataViewer\_1.inp…

---

_[View the full topic](https://forum.rtmaps.com/t/autostop-diagram/66)._
