The text field is no longer populated for mirror columns.
However, see the docs for the new API… Mirror
column_values v2 uses fragments for the different column types which can return more data. In this case, with ... on MirrorValue{display_value}
returns a text string of the values like the older text value. The reason for this, is it no longer has to lookup the text value of all connected items if the developer doesn’t need it.
The fragment only executes on MirrorValues. So if you only include id inside the fragment, id only gets returned for mirror columns.
You can have many fragment types in one query that will only execute on their respective types. Anything outside of fragments (or in a ... on ColumnValue
fragment) will always execute. (ColumnValue is the base type for all other value types).
query {
items (ids:i1234567890, 9876543210]) {
column_values {
... on MirrorValue {
id
display_value
}
}
}
}
All column types have a V2 fragment that can provide detail that the old v1 value property never included.
Thanks.
I read the documentation and I did not understand this situation. However, considereing the field value, is it correct that it came empty?
Yes it should be empty for mirror columns.
You can get mirror values using the ... on MirrorValue{display_value}
inside column_values as I showed, mirror columns will return their value then as “display_value”. You will also want to include the column type in the query to see if it is a mirror so you can account for reading the alternate field.
Thank you @anon29275264 !!!
Great, thanks again!
I believe that If I use the value outside the MirrorValue, the API will send me the JSON, but after your message and reading the documentation, I believe this will happen only if I put it inside.
Even the value field will be returned as null. As it stands in 2023-07 the value field is always null on mirrors, and only text ever has anything.
In 2023-10, text is now also always null, and you must use the ... on MirrorValue{display_value}
to get what used to be in the text field in 2023-07.
In 2023-10, ... on MirrorValue{value}
will still return null for value - as value has always been null on mirror columns.
I typically have a function that I call on the item.column_values that is something like this:
items.forEach((item) => {
item.column_values.forEach((cv) => {
if (cv.type != "mirror") return;
cv.text = cv.display_value;
}
}
This way for processing farther down the pipeline, everything is in text and I don’t have to put if statements throughout everything to check for mirror column.