<p>You have to use <code>'not 1'</code> instead of <code>'0'</code>:</p>

<pre><code>{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('not 1') %}
</code></pre>

CC BY-SA 3.0
2014-06-17T12:35:29.680Z
2014-06-17T12:52:43.587Z
2014-06-17T12:52:43.587Z
Victor
<p>I have a Resources page and an archived Resources page made up of entries. I want to show all current resources on the main page (this list should not include the archived ones) and on the archived page I only want to show only archived resources. I am using a lightswitch field to toggle whether a resource is archived or not.</p>

<p>The archived-only page works as expected, it shows only the archived resources, using this:</p>

<pre><code>{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('1') %}
</code></pre>

<p>The main page, which should show all resource entries except archived ones actually shows all resources (archived and unarchived). I’m using this code:</p>

<pre><code>{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('0') %}
</code></pre>

<p>It appears that the <code>.archivedResource(‘0’)</code> bit is not having any affect. Should I be using some other method to check whether a switch field is toggled or not?</p>

<lightswitch>
How do I check if a lightswitch field is false?
# How do I check if a lightswitch field is false?

(Asked by: username_0 on 2014-06-17)

I have a Resources page and an archived Resources page made up of entries. I want to show all current resources on the main page (this list should not include the archived ones) and on the archived page I only want to show only archived resources. I am using a lightswitch field to toggle whether a resource is archived or not.
The archived-only page works as expected, it shows only the archived resources, using this:
{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('1') %}

The main page, which should show all resource entries except archived ones actually shows all resources (archived and unarchived). I’m using this code:
{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('0') %}

It appears that the .archivedResource(‘0’) bit is not having any affect. Should I be using some other method to check whether a switch field is toggled or not?

**Tags:** lightswitch


---

## 1 answers

### Answer by username_1 on 2014-06-17. Score: 23 | Accepted answer

You have to use 'not 1' instead of '0':
{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('not 1') %}


---

