Answers.Body: <p>Searching table fields exactly is a bit difficult, because the selected values are stored as a JSON blob in the database. So you can't really query for specific values in specific columns directly. However, you <em>can</em> use the search index. The search index will include the entered values in all rows and columns. In the case of dropdown fields, the search index will include the handles of the selected values, not the option labels.</p>
  <pre><code>{% set eventsQuery = craft.entries()
      .section('events')
      .search('events:workshop')
  %}
  </code></pre>
  <p>However, it's impossible to distinguish between columns, so if any of the other columns include the term <code>workshop</code>, those will be found by this query as well.</p>
  <p>Searching tables is very imprecise, which is why I usually prefer to use categories and category fields for data like this. This makes it much easier to filter precisely by category using <a href="https://craftcms.com/docs/4.x/relations.html" rel="nofollow noreferrer">element relation filters</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-03T14:15:23.610Z
Answers.Text: Thanks for that! I actually tried search immediately after posting and to my surprise it worked. It doesn't need to be too precise in this case, so I'm happy to go with it. Thanks!
Answers.UserDisplayName: bigdev
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-03T13:54:45.983Z
Answers.LastActivityDate: 2023-03-03T13:54:45.983Z
Answers.UserDisplayName: MoritzLost
Body: <p>James helped me with part one and it's working well: <a href="https://craftcms.stackexchange.com/questions/40521/filtering-entries-via-a-dropdown-inside-a-matrix-block/40528#40528">Filtering entries via a dropdown inside a Matrix Block</a></p>
  <p>Now I would also like to filter by a table field as well. The table is <code>extras</code> and the columns I want to filter by is <code>type</code> -  a dropdown field where one example value is <code>workshop</code>. Based on the previous answer and my head, this is what I'm thinking:</p>
  <pre><code>{% set blockIds = craft.matrixBlocks.type('event').extras('type.workshop').ids() %}
  {% set eventsQuery = craft.entries.section('events').events(blockIds) %}
  </code></pre>
  <p>I'd appreciate any extra help! Thanks!</p>
  
Tags: <matrix><relations>
Title: Filtering entries via a table field inside a Matrix Block
ThreadText: # Filtering entries via a table field inside a Matrix Block
  
  (Asked by: username_0 on 2023-03-03)
  
  James helped me with part one and it's working well: [Filtering entries via a dropdown inside a Matrix Block](https://craftcms.stackexchange.com/questions/40521/filtering-entries-via-a-dropdown-inside-a-matrix-block/40528#40528)
  
  Now I would also like to filter by a table field as well. The table is `extras` and the columns I want to filter by is `type` - a dropdown field where one example value is `workshop`. Based on the previous answer and my head, this is what I'm thinking:
  
  ```
  {% set blockIds = craft.matrixBlocks.type('event').extras('type.workshop').ids() %}
  {% set eventsQuery = craft.entries.section('events').events(blockIds) %}
  
  ```
  
  I'd appreciate any extra help! Thanks!
  
  **Tags:** matrix, relations
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-03. Score: 2 | Accepted answer
  
  Searching table fields exactly is a bit difficult, because the selected values are stored as a JSON blob in the database. So you can't really query for specific values in specific columns directly. However, you *can* use the search index. The search index will include the entered values in all rows and columns. In the case of dropdown fields, the search index will include the handles of the selected values, not the option labels.
  
  ```
  {% set eventsQuery = craft.entries()
      .section('events')
      .search('events:workshop')
  %}
  
  ```
  
  However, it's impossible to distinguish between columns, so if any of the other columns include the term `workshop`, those will be found by this query as well.
  
  Searching tables is very imprecise, which is why I usually prefer to use categories and category fields for data like this. This makes it much easier to filter precisely by category using [element relation filters](https://craftcms.com/docs/4.x/relations.html).
  
  > **Comments:**
  > **username_0**: Thanks for that! I actually tried search immediately after posting and to my surprise it worked. It doesn't need to be too precise in this case, so I'm happy to go with it. Thanks!  
  
  ---
  
  