I’m looking to get the value of a column of type formula via the API.
And I’ve seen that others have already asked similar questions, so I’ll summarise
If I query like so:
query getItems {
items (ids: [ "xxxxx" ]) {
name
id
column_values {
id
text
type
}
board {
id
name
columns {
id
title
type
settings_str
}
}
}
}
I can see that column_values
for formula columns are blank:
{
"id": "formula",
"text": "",
"type": "formula"
},
Using the settings_str
field in board columns, I see the formula:
{
"id": "formula",
"title": "Formula",
"type": "formula",
"settings_str": "{\"formula\":\"SUM({numbers},{numbers0})\"}"
}
When JSON.parse
(d) we get:
{
"formula": "SUM({numbers},{numbers0})"
}
Reading around…
- Mutation: create_column for a 'formula' type column - #6 by amit.lzkpa
- Unable to get formula column values via API - #2 by PolishedGeek
…it appears that for formula columns, the column values are populated client side.
So somewhere there is some client-side code that knows monday’s formula language and given an item, can find all the formula columns within that item, and populate the correct formula values in the formula columns.
Rather than each developer having to reverse engineer this logic, is there something that we could all share?
I’m particularly looking at people from monday.com for an answer here.
This really makes sense when monday add new formulae and then everybody else has to scramble to update/reverse engineer the new formulae. Just bumping to the new version of a library would be awesome.