Skip to main content

I am running into a problem where while creating a column with a status type and creating the possible labels, some labels are not appearing. However, the return json shows they are there and the column summary also shows there is a value there.


Any idea what may be causing this? Am I hitting some sort of limit?


Note, I skip label 5 because monday.com sets label 5 as the default empty value.


def create_columns(board_id, title, column_type, default_values=None):
if default_values:
vals_dict = {}
for cnt, vals in enumerate(default_values):
if cnt == 4:
cnt += 1
vals_dict[cnt + 1] = vals
status_values = {"labels": vals_dict}
else:
status_values = ''

query = """
mutation ($boardId: ID!, $titleName: String!, $columnType: ColumnType!, $defaultValues: JSON) {
create_column(
board_id: $boardId
title: $titleName
column_type: $columnType
defaults: $defaultValues
) {
id
title
}
}
"""

variables = {
'boardId': board_id,
'titleName': title,
'columnType': column_type,
'defaultValues': json.dumps(status_values, separators=(',', ':'))
}

datas = {
'query': query,
'variables': variables
}

r_boards = requests.post(url=apiUrl, headers=headers, data=json.dumps(datas)) # make request
print(variables)
print(r_boards.json())

return r_boards

>>>
{'boardId': '1234', 'titleName': 'Location', 'columnType': 'status', 'defaultValues': '{"labels":{"1":"label one","2":"label two","3":"label three","4":"label four","6":"label six","7":"label seven","8":"label eight","9":"label nine","10":"label ten","11":"label eleven","12":"label twelve","13":"label thirteen","14":"label fourteen","15":"label fifteen","16":"label sixteen","17":"label seventeen","18":"label eighteen","19":"label nineteen","20":"label twenty","21":"label twenty one","22":"label twenty two"}}'}

{'data': {'create_column': {'id': 'location', 'title': 'Location'}}, 'account_id': 12345}

Column Labels


When a item with “label twenty” is created

OOH! You’re discovering the range of indexes is sparse! The range is 0-19, 101-110, 151-160. And of course you already remembered 5 is special.


Here is a list of all the valid indexes and colors


Nice! Do you know why those index ranges are sparse or why those particular ranges? Those ranges can’t be random, but that seems very odd to limit it.


I do not have an answer for that. My suspicion is that they are groups of colors they intended to work together. the 101-110 range seems to be used for the “Label” column type (which is just a special implementation of “Status”)


But it sure seems like it can lead to some pains coding.


Reply