填写一个分配百分比列并让它很好地显示
Filling in an allocation % column and have it display nicely
作为我正在进行的使用 python 以编程方式填写项目表的项目的一部分,我正在填写 % Allocated 列(这是一个带有 TAG 'GANTT_ALLOCATION' 的列)。我一直将我的值作为浮点数发送,这适用于资源视图,但在智能表中显示为浮点数。
然而,使用 curl sdk 似乎显示为百分比。
Python:
this_allocation = 0.5
SS.models.Cell({
'column_id': column_map['% Allocated'],
'value': this_allocation,
# 'display_value': "{:d}%".format(int(this_allocation*100))
})
在 Smartsheet 中显示:0.5
我们自己的旧 python api 直接使用其余 api,显示为 50%。另外,如果我直接在 UI 中输入它,它会显示 50%。
我尝试设置显示值但没有成功。
我还尝试将值作为 int 发送(上限为 1),作为 string/unicode(显示正确但不计算)。
我错过了什么?
谢谢
您需要将 cell/column 的格式设置为百分比。有关所有可能的详细信息,请参阅 API docs。
SS.models.Cell({
'column_id': column_map['% Allocated'],
'value': this_allocation,
'format': ',,,,,,,,,,,,,,3,'
})
作为我正在进行的使用 python 以编程方式填写项目表的项目的一部分,我正在填写 % Allocated 列(这是一个带有 TAG 'GANTT_ALLOCATION' 的列)。我一直将我的值作为浮点数发送,这适用于资源视图,但在智能表中显示为浮点数。 然而,使用 curl sdk 似乎显示为百分比。 Python:
this_allocation = 0.5
SS.models.Cell({
'column_id': column_map['% Allocated'],
'value': this_allocation,
# 'display_value': "{:d}%".format(int(this_allocation*100))
})
在 Smartsheet 中显示:0.5
我们自己的旧 python api 直接使用其余 api,显示为 50%。另外,如果我直接在 UI 中输入它,它会显示 50%。 我尝试设置显示值但没有成功。 我还尝试将值作为 int 发送(上限为 1),作为 string/unicode(显示正确但不计算)。
我错过了什么? 谢谢
您需要将 cell/column 的格式设置为百分比。有关所有可能的详细信息,请参阅 API docs。
SS.models.Cell({
'column_id': column_map['% Allocated'],
'value': this_allocation,
'format': ',,,,,,,,,,,,,,3,'
})