How to programmatically erase a date column cell, with project settings and dependencies enabled?
Hi everyone! Need your help! I'm currently facing a challenge while attempting to programmatically erase a date column cell, with project settings and dependencies enabled. I am able to change the date, but not able to erase the existing date. I can successfully delete the column value manually, but I'm not able to achieve the same using the Smartsheet SDK 2.105.1. Note: The column properties state, "This column type can't be changed due to the following: It's being used in schedule calculations. Edit project settings." Thank You!
Answers
-
So what are you using the SDK to connect to? I don't have a lot of experience with the SDK, but some more context would most likely help anyone else that might be able to help.
Jonathan Sanders, CSM
"Change is always scary because it is unknown, but facing the unknown is what makes us stronger."
-
pseudo code:
new_row = smartsheet_client.models.Row()
new_row.id = row_id
new_cell = ss_client.models.Cell()
new_cell.column_id = column_id
new_cell.value = '' #Not deleting the existing cell value. The column project settings/dependencies enabled.
#new_cell.value = today #Succesfully updated the cell value with today
new_cell.strict = False
new_row.cells.append(new_cell)
smarthseet_client.Sheets.update_rows(sheet_id, [new_row])
-
Let me rephrase my question. If the column has project settings and dependencies enabled, is it possible to programmatically erase the date cell directly through the Smartsheet API?
Through API, I am able to update but not able to erase the existing date.
code:
new_row = smartsheet_client.models.Row() new_row.id = row_id new_cell = ss_client.models.Cell() new_cell.column_id = column_id new_cell.value = '' #Not erasing the existing cell value. The column project settings/dependencies are enabled. #new_cell.value = today #Succesfully updated the cell value with today. The Column project settings/dependencies are enabled. new_cell.strict = False new_row.cells.append(new_cell) smarthseet_client.Sheets.update_rows(sheet_id, [new_row])
-
Hi @Devi
You need to remove the "Predecessors" value first.
Then, as new_cell.value=" or " " does not work to set a Date cell to blank, I set the value to something else like, "None."
code:
# Remove Predecessors
new_cell = smartsheet.models.Cell()
new_cell.column_id = column_map["Predecessors"] # a dictionary created before (map[title]=id)
new_cell.value = ""
new_cell.strict = False
new_row.cells.append(new_cell)
# Remove Start Date Value
new_cell = smartsheet.models.Cell()
new_cell.column_id = column_map['Start']
new_cell.value = "None" # "" or " " does not work so "nothing" etc.
new_cell.strict = False
new_row.cells.append(new_cell)
-
@jmyzk_cloudsmart_jp What is the reason behind the need to delete the value of the Predecessors first? Today, I was able to successfully erase the Start date column, even with dependencies enabled, without removing the value of the predecessors. It's unclear why this functionality didn't work in the past. Thank You!
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives