Syntax Help: Searching To Do list for Input Text Helper

Hello,

I am trying to search a todo list to see if it has an item with the same name as an input text helper. I have the following:

alias: "To Do: Unfinished Weekly Long Task"
description: ""
trigger:
  - platform: time
    at: "18:00:00"
condition:
  - condition: time
    weekday:
      - wed
action:
  - service: todo.get_items
    metadata: {}
    data:
      status: needs_action
    response_variable: long_dan
    target:
      entity_id: todo.dan_s_long_term_task_for_the_week
  - if:
      - condition: template
        value_template: >-
          {{
          long_dan['todo.dan_s_long_term_task_for_the_week']['items']|selectattr('summary','search','{{
          states('input_text.dan_s_weekly_long_term_task') }}')|list|count > 0
          }}
        enabled: true
    then:
      - service: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.emily_s_weekly_long_term_task_status
mode: single

However, my template causes the following error:

Message malformed: invalid template (TemplateSyntaxError: expected token ‘,’, got ‘input_text’) for dictionary value @ data[‘action’][1][‘if’][0][‘value_template’]

What is wrong with my syntax?

You have nested quotes and templates. Try:

{{ long_dan['todo.dan_s_long_term_task_for_the_week']['items']
   |selectattr('summary','search',states('input_text.dan_s_weekly_long_term_task'))
   |list|count > 0 }}

It works! Thank you!