From what I learnt should be a dictionary, I suppose like that:
serie1: [ “id”: 0. “cardinals”: N, “wind”: "tramontana, “type”: “string”, “meteotype”: “string”]
serie2: [ “id”: 22.5. “cardinals”: NNE, “wind”: "bora, “type”: “string”, “meteotype”: “string”]
serie3: [ “id”: 45. “cardinals”: NE, “wind”: "greco, “type”: “string”, “meteotype”: “string”]
and so on
I got a variable where is the value “degrees” and to be used as key item,
to retrieve data value eg. “Wind” based on degress
I suppose ( not so expert) should be used >> for…endfor
“I dont know” how to implement and write in right way
Help and suggestios are more than wellcome
great, it works perfectly
and that0s more fòexble tham i expected
I mean; it takes value on both left and right
{% set goofy = "NE" %}
{%- set table = [ { "id": "0", "cardinals": "N", "wind": "tramontana", "type": "string", "meteotype": "string"},
{ "id": "22.5", "cardinals": "NNE", "wind": "bora", "type": "string", "meteotype": "string"},
{ "id": "45", "cardinals": "NE", "wind": "greco", "type": "string", "meteotype": "string"} ] -%}
{{ table | selectattr("cardinals", "eq", goofy) | map(attribute="id") | list | first }}
said that......j would like to use the table as "multi purpose".
excuse me i dont have the property of right semantic.
I try to explian in better way
Where to write/define the table structure?
i write TABLE once time and then i call on a1,b1,a2,b2 and so on I’m lost here on this point
I mean; on a1 “block definitions” is “easy”,
I set “goofy” with degrees value
i call “table” with the sentence:
{{ table | selectattr(“degress”, “eq”, goofy) | map(attribute=“id”) | list | first }}
I get the result as my expectations
Hi,
well at the begining was a bit in “panic” but ok:
create custom_templates
create new file with jinja extensions
put my table inside
reload all configurations
in Developer tools | Templat i wrote:
{% from 'blabla.jinja' import table %}
{{ table | selectattr("id", "eq", "0") | map(attribute="wind") | list | first }} *[u]>>> thks @Jeffcrum :-)[/u]*
Greta it works, I see "tramontana"
I didnt put
{% macro %}
{% endmacro %}
*[u]is correct from system_view?[/u]*
Thanks in advance for support