# Conditional inputs

Input conditional dependent on other input results. To use it, the name of the parent input has to be included as the parameter 'dependsOn' of the child, like so:

<pre class="language-python"><code class="lang-python">report_dataset_properties = {
    'fields': [{
            'title': 'Conditional input form',
            'fields': [
                {
                    'mapping': 'country',
<strong>                    'fieldName': 'Country',
</strong>                    'inputType': 'select',
<strong>                    'options': ['España', 'Colombia']
</strong>                },
                {
<strong>                    'dependsOn': 'Country',
</strong>                    'mapping': 'city',
                    'fieldName': 'City',
                    'inputType': 'select',
<strong>                    'options': {
</strong><strong>                        'España': ['Madrid', 'Barcelona'],
</strong><strong>                        'Colombia': ['Bogotá', 'Medellin']
</strong>                    }
                }
            ]
        }
    ]
}

s.plt.input_form(
    order=0, options=input_data
)
</code></pre>

When the input has the parameter 'dependsOn', it has to define a set of options for every option in the parent input. In the case shown above the parent input has the options: 'España', 'Colombia', so the child input defines the list **\['Madrid', 'Barcelona']** for **'España'** and **\['Bogotá', 'Medellin']** for '**Colombia**'. The result is:

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2F4Kceqau8dEeA6NPFPh4h%2Fimage.png?alt=media&#x26;token=6028df7c-34ec-4fb8-b91e-73e6777fe682" alt=""><figcaption><p>Resulting options in child when selecting 'España' in the parent input</p></figcaption></figure>

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2F2Ap16SqrhTlxm2ZwfBHw%2Fimage.png?alt=media&#x26;token=59f782db-63fd-4a71-8a1f-0e55828a1170" alt=""><figcaption><p>Resulting options in child when selecting 'Colombia' in the parent input</p></figcaption></figure>
