# Optional port in grc block

**URL:** <https://www.ruby-forum.com/t/optional-port-in-grc-block/233671>\
**Category:** GNU Radio\
**Created:** [January 2, 2015, 7:25pm UTC](https://www.ruby-forum.com/t/optional-port-in-grc-block/233671 "2015-01-02T19:25:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [January 2, 2015, 7:25pm UTC](https://www.ruby-forum.com/t/optional-port-in-grc-block/233671/1 "2015-01-02T19:25:45Z")

</div>

Hi all,

I would like to have grc block with a bool option “Debug”.  
Once this is set to True, then I would like to have an additional output  
port.

How do I do that?

I already added this part in the xml file:

 Debug debug False bool 

but now I don’t know how to use this variable to make the additional  
port  
appear  
in the block.

thanks  
Achilleas

-

---

<div class="post-metadata">

**Author:** ![Achilleas\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Achilleas\_A](https://www.ruby-forum.com/u/Achilleas_A)\
**Post date:** [January 4, 2015, 11:19am UTC](https://www.ruby-forum.com/t/optional-port-in-grc-block/233671/2 "2015-01-04T11:19:25Z")

</div>

Achilleas,

ports can use the tag like params do (note this tag is the last  
tag for any sink or source). Just put some Cheetah code in there to  
check for $debug and set hide to all, part or none.

M

---

<div class="post-metadata">

**Author:** ![Achilleas\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Achilleas\_A](https://www.ruby-forum.com/u/Achilleas_A)\
**Post date:** [January 4, 2015, 5:59pm UTC](https://www.ruby-forum.com/t/optional-port-in-grc-block/233671/3 "2015-01-04T17:59:52Z")

</div>

On Sun, Jan 4, 2015 at 5:17 AM, Martin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Achilleas,
> 
> ports can use the tag like params do (note this tag is the last  
> tag for any sink or source). Just put some Cheetah code in there to  
> check for $debug and set hide to all, part or none.
> 
> M

There are lots of examples for how to use the hide tag in parameters and  
ports, though mostly for message ports. Check out the  
constellation\_receiver XML file for how it uses a boolean parameter to  
determine if it should show the message port or not.

Tom
