<p>Just saw this resolved issue on GitHub: <a href="https://github.com/craftcms/cms/issues/5930" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/5930</a></p>
<p>So Lightswitch querying should be fixed in the upcoming release CraftCMS 3.5</p>
<hr />
<p>Edit: there is a workaround until 3.5 is released. see comment by @harrymee123 and my example query at <a href="https://github.com/craftcms/cms/issues/5930#issuecomment-657417173" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/5930#issuecomment-657417173</a></p>

CC BY-SA 4.0
2020-04-30T15:33:58.673Z
2020-07-14T19:40:57.053Z
2020-07-14T19:40:57.053Z
Denis
<p>I have two entry types that I want to show in a sorted list (by postDate, with paginating).</p>

<pre><code>{
  entries(
    type: ["entryType1", "entryType2"],
    orderBy: "postDate desc",
    limit: 5,
    offset: 0
  ) {
    id
    title
    postDate
    typeHandle
  }
}
</code></pre>

<p>This already works. Now the second post type <code>entryType2</code> should have an optional Lightswitch <code>showInList</code>, where the editor can decide if the entry should appear in the list.</p>

<pre><code>{
  entries(
    type: ["entryType1", "entryType2"],
    orderBy: "postDate desc",
    showInList: 1,
    limit: 5,
    offset: 0
  ) {
    id
    title
    postDate
    typeHandle
  }
}
</code></pre>

<p>Unfortunately with the adapted querying I only get the entries of the type with the Lightswitch field declared. When setting <code>showInList: null</code> I get all entries of both entry types, but its ignoring if <code>showInList</code> is true/false for any entry of the second post type.
I tested different QueryArguments but its seems they all have no effect.</p>

<p>Every QueryArgument is handled as if <code>true</code></p>

<p>Tested:  </p>

<ul>
<li><code>showInList: 1</code> &rarr; shows only entries of <code>entryType2</code> with
showInList set to <code>true</code>, ignores <code>entryType2</code></li>
<li><code>showInList: ['not 1']</code> &rarr; I thought this would give all entries of <code>entryType2</code> with <code>showInList</code> set to false but it behaves the same as <code>showInList: 1</code>  </li>
<li><code>showInList: null</code> &rarr; shows entries of both types but ignores the <code>showInList</code> field</li>
</ul>

<p>is there something like <code>showInList: ['1 or undefined']</code> or any other <code>QueryArgument</code> that would give me the expected result?</p>

<p>Tested in CraftCMS 3.4.17.1 with full schema</p>

<craft-pro><graphql>
Query for Lightswitch in GraphQL
# Query for Lightswitch in GraphQL

(Asked by: username_0 on 2020-04-30)

I have two entry types that I want to show in a sorted list (by postDate, with paginating).
{
  entries(
    type: ["entryType1", "entryType2"],
    orderBy: "postDate desc",
    limit: 5,
    offset: 0
  ) {
    id
    title
    postDate
    typeHandle
  }
}

This already works. Now the second post type entryType2 should have an optional Lightswitch showInList, where the editor can decide if the entry should appear in the list.
{
  entries(
    type: ["entryType1", "entryType2"],
    orderBy: "postDate desc",
    showInList: 1,
    limit: 5,
    offset: 0
  ) {
    id
    title
    postDate
    typeHandle
  }
}

Unfortunately with the adapted querying I only get the entries of the type with the Lightswitch field declared. When setting showInList: null I get all entries of both entry types, but its ignoring if showInList is true/false for any entry of the second post type.
I tested different QueryArguments but its seems they all have no effect.
Every QueryArgument is handled as if true
Tested:  

showInList: 1 → shows only entries of entryType2 with
showInList set to true, ignores entryType2
showInList: ['not 1'] → I thought this would give all entries of entryType2 with showInList set to false but it behaves the same as showInList: 1 
showInList: null → shows entries of both types but ignores the showInList field

is there something like showInList: ['1 or undefined'] or any other QueryArgument that would give me the expected result?
Tested in CraftCMS 3.4.17.1 with full schema

**Tags:** craft-pro, graphql


---

## 1 answers

### Answer by username_0 on 2020-04-30. Score: 2 | Accepted answer

Just saw this resolved issue on GitHub: <https://github.com/craftcms/cms/issues/5930>

So Lightswitch querying should be fixed in the upcoming release CraftCMS 3.5

---

Edit: there is a workaround until 3.5 is released. see comment by @harrymee123 and my example query at <https://github.com/craftcms/cms/issues/5930#issuecomment-657417173>


---

