Skip to content
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.

calculate field to null? #36

Closed
DShokes opened this issue Mar 23, 2015 · 1 comment
Closed

calculate field to null? #36

DShokes opened this issue Mar 23, 2015 · 1 comment

Comments

@DShokes
Copy link
Contributor

DShokes commented Mar 23, 2015

I can't figure out the syntax for setting values to null.
I've tried:

fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "value" : null})
fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "value" : NULL})
fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "value" : <Null>})
#all errors as expected
fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "value" : 'null'})
fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "value" : '<Null>'})
#return string values
fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "value" : None})
# {'error': {'message': 'Unable to calculate fields.', 'code': 400, 'details': ['Object reference not set to an instance of an object.']}}

Thanks

@DShokes
Copy link
Contributor Author

DShokes commented Mar 23, 2015

I think I solved it.

fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "sqlExpression" : "null"}, sqlFormat="native") )

Perhaps arcREST would benefit with a sample using calculate variations of "value" and "sqlExpression" with sqlFormat="native" or "standard"

I'm still having issues calculating a value with single quotes:

fl.calculate(where="CustomerID=168453", calcExpression={"field" : "CompanyName_1", "sqlExpression" : "Applebee's"}, sqlFormat="native") )

but this may be unrelated to arcREST.

@DShokes DShokes closed this as completed Mar 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant