You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we attempt to use only dot notation to access the data as in this card definition, where prova is the name of the attribute:
type: custom:flex-table-card
entities:
include: sensor.mydata
columns:
- name: Field A
data: prova.my_data.field_a
- name: Field B
data: prova.my_data.field_b
...then the result is:
We have no choice but to use the modify option for the lowest level to get it to work:
type: custom:flex-table-card
entities:
include: sensor.mydata
columns:
- name: Field A
data: prova.my_data
modify: x.field_a
- name: Field B
data: prova.my_data
modify: x.field_b
This need to use the modify option in combination with the data option not only confuses users and leads to numerous Issues and questions, it also has undesirable side effects. For example, modify often ends up having a dual purpose, one as an object selector, and also as a formatter. When trying to sort or sum (new feature) a column, we always need the selector, but often find that the formatting gets in the way of a proper sort or summation. The sort_unmodified option can be used to remove what is added by modify, but if modify is used as an object selector, this won't work. Using the modify option to both select and format data breaks a fundamental rule of data processing, and we can see the unfortunate results. The modify option is also somewhat risky.
Fortunately, a solution is available in an upcoming PR.
The text was updated successfully, but these errors were encountered:
This issue has been discussed in #76, #86 and #87, and probably elsewhere, but I'd like to add some clarity here.
Dot notation works fine for singletons. Take this example attribute structure from #87:
This attribute's elements can be accessed using dot notation, without the need for the
modify
option, as in this card definition:The result is:
However, dot notation does not fully work when the result is an array. Consider this
JSON
from #76:{"my_data":[{"field_a":"a","field_b":"b"},{"field_a":"a","field_b":"b"}]}
If we attempt to use only dot notation to access the data as in this card definition, where
prova
is the name of the attribute:...then the result is:
We have no choice but to use the
modify
option for the lowest level to get it to work:This need to use the
modify
option in combination with thedata
option not only confuses users and leads to numerous Issues and questions, it also has undesirable side effects. For example,modify
often ends up having a dual purpose, one as an object selector, and also as a formatter. When trying to sort or sum (new feature) a column, we always need the selector, but often find that the formatting gets in the way of a proper sort or summation. Thesort_unmodified
option can be used to remove what is added bymodify
, but ifmodify
is used as an object selector, this won't work. Using themodify
option to both select and format data breaks a fundamental rule of data processing, and we can see the unfortunate results. Themodify
option is also somewhat risky.Fortunately, a solution is available in an upcoming PR.
The text was updated successfully, but these errors were encountered: