> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.carbone.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to hide shapes conditionally? (lines, circles, squares)


# How to hide shapes conditionally

Two solutions are available:
* **NEW** Use the [drop formatter](#2-first-solution)
* Use [hideBegin/hideEnd formatters](#2-second-solution)

It is supported only for DOCX and ODT files.

| Learn more about `:drop` formatter on the [documentation](https://carbone.io/documentation/design/conditions/smart-conditions.html#drop-keep-element)

## First solution

Since Carbone `v4.3.0`, the `drop` formatter is available to delete shapes and any element from a document. Be sure to request version 4 (or higher) of Carbone:
* For the Cloud API: set the header `"carbone-version":4`
* For the Cloud Studio: Click on the top-right "settings" icon > click on "version" > Select `4.X.X`.

For the following exemple, we want to drop a round shape if a value is empty.
Include the Carbone tag `{d.text:ifEM:drop(shape)}` within a shape alternate text, title or description.
* the `d.text` value is a text as a string type coming from a JSON dataset
* the `:ifEM` is a conditional formatter checking if the value is empty.
* the `:hide(shape)` formatter is fired if the previous condition is true. The first argument `shape` is required to defined the element to hide.

Locations to insert tags for:
* **LibreOffice**: Click on the shape > Select the `Draw` tab > click on the `draw` button on the top left menu > Click on `Title` or `Description` > insert the tag
* **MS Word**: Right click on the shape > click on "edit alt text" >  insert the tag

![ODT template edited with LibreOffice](https://storage.crisp.chat/users/helpdesk/website/f355e91d7615e000/screenshot-2022-09-09-at-18295_19afd8j.png)

## Second solution

For the following exemple, we want to drop a line shape if a value is empty.
Wrap the shape anchor with a `hideBegin` and `hideEnd` expression.

### 1. Insert the drawing

A line is inserted on the ODT document.

![Line on an ODT document](https://storage.crisp.chat/users/helpdesk/website/f355e91d7615e000/screenshot-2021-07-01-at-17221_16ie5yu.png)

### 2. Change the drawing anchor to "as character"

![Line anchor changed to as character](https://storage.crisp.chat/users/helpdesk/website/f355e91d7615e000/screenshot-2021-07-01-at-17234_1cdptaw.png)

### 3. Wrap the anchor point with conditional tags

The following screenshot is based on the JSON dataset: `{ "value" : true }`

![Wrap the drawing with tags](https://storage.crisp.chat/users/helpdesk/website/f355e91d7615e000/screenshot-2021-07-01-at-17255_z432e6.png)

Generates the PDF report with Carbone, and voilà 🎉