Flex-table-card - filter entries (included via service: todo.get_items)

Hi all :slight_smile:
I try to set up a table to display my manually read meter values (gas, water, electricity). I got so far to use multiple custom:flex-table-card’s and select the entries from the todo lists (if anyone has a smarter solution I am open for it :smiley: ).
In the description of the todo-list I past the regarding year so I am able to filter by it.
If I try to filter the entries via a input_text helper like
"{{ state('input_text.year') }}"
instead of “2024” I do not get displayed a single entry correct…

type: custom:flex-table-card
service: todo.get_items
entities:
  - todo.zahler
columns:
  - name: Datum
    data: items
    modify: if (x.description == "2024" ) {x.summary} else {'x'}
  - name: Datum
    data: items
    modify: x.description
sort_by:
  - items+
max_rows: 24

This is the current output:

Of course I normally set max_rows to 12 to “filter” only for the current year values

Does anyone has any suggestions? :slight_smile:

If the you need the full card configuration just let me know, but it’s just similar to the one I pasted in a horizontal stack.

Many thanks in advance!

Provide what your source looks like

I did not find an option to get the yaml from the frontend so I took a screenshot:


The data in the list is from 01 - 2023 till 12 - 2024 as “item summary” and in the “description” I planned to write the year (you see some examples in the background).

input_text.jahr is a helper I created with the GUI.

My biggest issue (as long as there is not a much smarter way to do the whole thing at all) is that the following isn’t working:
modify: if (x.description == "{{ state('input_text.jahr') }}" ) {x.summary} else {'x'}

The state of input_text.jahr is 2024. I already checked this in the developer tools - states

For me it looks like it does not get it, that state(‘input_text.jahr’) = 2024 and therefore it occurs that all items gets marked as ‘x’…
I already tried:

"{{ state('input_text.jahr') }}"
'{{ state('input_text.jahr') }}'
{{ state('input_text.jahr') }}

Try 1) make results in the output picture i post with my next message (seems like I can only send one image per message), 2) and 3) cause that no output is displayed at all.

Thanks for your reply :slight_smile:
Hope this was not to much information :smiley: Im using Home Assistant now for one month and still getting used to everything, but this is the first time I do not find a solution for days now.

Output for

type: custom:flex-table-card
service: todo.get_items
entities:
  - todo.zahler
columns:
  - name: Datum
    data: items
    modify: if (x.description == "{{ state('input_text.jahr') }}" ) {x.summary} else {'x'}
  - name: description
    data: items
    modify: x.description
sort_by:
  - items+

is:

There are only a few cards that allow templating directly, I am quite (not 100%) sure that this card does not.
In that case you can use a wrapper card, this one I like myself

iantrich/config-template-card: :memo: Templatable Lovelace Configurations (github.com)

Do you have any syntax suggestions? I am not getting any tries to work… I am about to use a conditional card and copy my card for every year and just display the one regarding to the choosen year in input_text.jahr, but this would be a very ugly workaround in my opinion :frowning: