<p>The error was in the increment variable because it is optional. If there is no value it throws an error it shoudl default to <code>1</code></p>
<p>So I constructed it like this:</p>
<pre><code>{% for item in variants.b2bProductQty %}

  {% set start = item.rangeStart %}
  {% set end = item.rangeEnd %}
  {% set increment = item.rangeInc ? item.rangeInc : 1 %} {# fallback to 1 #}
                                
  {% for i in range( item.rangeStart , item.rangeEnd, increment) %}
    &lt;option value=&quot;{{ variants.sku }}:&quot;&gt;{{ i }}&lt;/option&gt;
  {% endfor %}
                                
{% endfor %}
</code></pre>

CC BY-SA 4.0
2023-11-03T18:50:38.137Z
2023-11-03T18:50:38.137Z
KSPR
<p>I can't test easily because I never use Supertable, but my guess would be that if you were to dump out <code>item.selectRange.cellStartInteger</code> (DUMP out, not just print out - ie.<code>{{ dump(item.selectRange.cellStartInteger) }}</code>), you might find that it's a big complicated object rather than just a simple value. In that case, if it's anything like Craft's dropdown field you'll need to put <code>.value</code> on the end to get just the raw value.</p>

CC BY-SA 4.0
2023-11-03T18:24:44.140Z
You are correct. The dump outputs `int(5)`

I switched back to regular integer fields but this outputs the same. How do I only get `5` ?
KSPR
CC BY-SA 4.0
2023-11-04T21:55:05.233Z
Well, no... `int(5)` means I'm not correct here. It's not a big complicated object as I was guessing - this means it's a simple integer, as it should be.
James Smith
CC BY-SA 4.0
2023-11-03T14:00:48.493Z
2023-11-03T14:00:48.493Z
James Smith
<p>How do I pass variables into the range filter from a static supertable field?</p>
<pre><code>{% for item in variants.b2bProductQty %}

  {% set start = item.selectRange.cellStartInteger %}
  {% set end = item.selectRange.cellEndInteger %}
  {% set increment = item.selectRange.cellIncerement %}

  {% for i in range(start, end, increment) %}
     &lt;option value=&quot;{{ variants.sku }}:&quot;&gt;{{ i }}&lt;/option&gt;
  {% endfor %}

{% endfor %}
</code></pre>
<p>This results in the error:</p>
<blockquote>
<p>range(): Argument #3 ($step) must not exceed the specified range</p>
</blockquote>
<p>When I hardcode the numbers from the field it works</p>
<pre><code>{% for i in range(5, 50, 5) %}
   &lt;option value=&quot;{{ variants.sku }}:&quot;&gt;{{ i }}&lt;/option&gt;
{% endfor %}
</code></pre>
<p>If I just print out <code>{{ start }}</code> it shows <code>5</code> just fine</p>

CC BY-SA 4.0
2023-11-03T13:34:16.043Z
could it be that you have a typo? "cellIncerement" instead of "cellIncrement"
Johannes Håkonsen
<templating><filter><plugin-supertable><range>
Range filter doesn't accept variables
# Range filter doesn't accept variables

(Asked by: username_0 on 2023-11-03)

How do I pass variables into the range filter from a static supertable field?
{% for item in variants.b2bProductQty %}

  {% set start = item.selectRange.cellStartInteger %}
  {% set end = item.selectRange.cellEndInteger %}
  {% set increment = item.selectRange.cellIncerement %}

  {% for i in range(start, end, increment) %}
     {{ i }}
  {% endfor %}

{% endfor %}

This results in the error:

range(): Argument #3 ($step) must not exceed the specified range

When I hardcode the numbers from the field it works
{% for i in range(5, 50, 5) %}
   {{ i }}
{% endfor %}

If I just print out {{ start }} it shows 5 just fine

**Tags:** templating, filter, plugin-supertable, range
> **Comments:**
> **username_1**: could it be that you have a typo? "cellIncerement" instead of "cellIncrement"  

---

## 2 answers

### Answer by username_0 on 2023-11-03. Score: 1 | Accepted answer

The error was in the increment variable because it is optional. If there is no value it throws an error it shoudl default to 1
So I constructed it like this:
{% for item in variants.b2bProductQty %}

  {% set start = item.rangeStart %}
  {% set end = item.rangeEnd %}
  {% set increment = item.rangeInc ? item.rangeInc : 1 %} {# fallback to 1 #}
                                
  {% for i in range( item.rangeStart , item.rangeEnd, increment) %}
    {{ i }}
  {% endfor %}
                                
{% endfor %}


---

### Answer by username_2 on 2023-11-03. Score: 1

I can't test easily because I never use Supertable, but my guess would be that if you were to dump out `item.selectRange.cellStartInteger` (DUMP out, not just print out - ie.`{{ dump(item.selectRange.cellStartInteger) }}`), you might find that it's a big complicated object rather than just a simple value. In that case, if it's anything like Craft's dropdown field you'll need to put `.value` on the end to get just the raw value.

> **Comments:**
> **username_0**: You are correct. The dump outputs `int(5)`  I switched back to regular integer fields but this outputs the same. How do I only get `5` ?  
> **username_2**: Well, no... `int(5)` means I'm not correct here. It's not a big complicated object as I was guessing - this means it's a simple integer, as it should be.  

---

