<p>At the time of this post, the only variable available to the settings template that might help you out is the settings object: <code>{{ dump(settings) }}</code>.</p>
<p>As this is the Twig Template report, you might be able to use the <code>settings.resultsTemplate</code> value to identify the active report in a shared settings file.</p>
<hr />
<p>I've <a href="https://github.com/barrelstrength/craft-sprout-reports/issues/108" rel="nofollow noreferrer">opened a ticket</a> for adding improved support for this scenario and will look into making the <code>dataSource</code> object available to the settings template in a coming release.</p>

CC BY-SA 4.0
2021-03-15T21:18:13.533Z
`settings.resultsTemplate` is what I was looking for.  Thanks!
Sheldon
CC BY-SA 4.0
2021-03-15T20:21:05.157Z
2021-03-15T20:21:05.157Z
Ben Parizek
<p>I have several reports to create but their settings are going to be very similar.  So I want to use one settings.twig for all of them and detect which report is the current one to show any extra settings.</p>
<p>Something like this pseudo code:</p>
<pre class="lang-html prettyprint-override"><code>&lt;div&gt;&lt;!--common field--&gt;&lt;/div&gt;
&lt;div&gt;&lt;!--common field--&gt;&lt;/div&gt;
&lt;div&gt;&lt;!--common field--&gt;&lt;/div&gt;
{% set current_report = craft.barrelstrength.sproutreports.current %}
{% if current_report == 'fourth_quarter_payments' %}
  &lt;div&gt;&lt;!--some field--&gt;&lt;/div&gt;
{% elseif current_report == 'payments_above_100' %}
  &lt;div&gt;&lt;!--some field--&gt;&lt;/div&gt;
{% endif %}
</code></pre>
<p>Is it possible to know what the current report is so conditionals can be used in the settings template?</p>

<craft3><plugin-sproutreports>
How to detect the current report in settings.twig
# How to detect the current report in settings.twig

(Asked by: username_0 on 2021-01-25)

I have several reports to create but their settings are going to be very similar.  So I want to use one settings.twig for all of them and detect which report is the current one to show any extra settings.
Something like this pseudo code:



{% set current_report = craft.barrelstrength.sproutreports.current %}
{% if current_report == 'fourth_quarter_payments' %}
  
{% elseif current_report == 'payments_above_100' %}
  
{% endif %}

Is it possible to know what the current report is so conditionals can be used in the settings template?

**Tags:** craft3, plugin-sproutreports

---

## 1 answers

### Answer by username_1 on 2021-03-15. Score: 1 | Accepted answer

At the time of this post, the only variable available to the settings template that might help you out is the settings object: `{{ dump(settings) }}`.

As this is the Twig Template report, you might be able to use the `settings.resultsTemplate` value to identify the active report in a shared settings file.

---

I've [opened a ticket](https://github.com/barrelstrength/craft-sprout-reports/issues/108) for adding improved support for this scenario and will look into making the `dataSource` object available to the settings template in a coming release.

> **Comments:**
> **username_0**: `settings.resultsTemplate` is what I was looking for.  Thanks!  

---

