Search code examples
pythonrestversionone

Unable to sum task actuals using VersionOne Python SDK


Using the Python SDK for VersionOne, I'm trying to sum the actuals for each task. Here's my best guess at how to do this.

term="Actuals:Actual.Value.@Sum"

for task in v1.Task.select("Name",term).filter("AssetState!='Dead'"):
    print(task.Name,task.data[term])

First, the task.data[term] bit is based on the docs, but there's no such key. The closest key in the returned task is "Actuals:Actual".

Second, using that as the key instead seems to work for tasks that have no actuals, although instead of "0", I get an empty string.

Finally, once I hit a task with some actuals, I get an AttributeError in v1pysdk.v1meta.add_attribute_to_output(), which is somehow using "6" (the actual actual) as a base_asset, calling its with_data() method.

I'm able to get these sums using, e.g.,

<server-base>/rest-1.v1/Data/Task/1234/Actuals:Actual.Value.@Sum

so surely I'm close. Is there a way to do this with the Python SDK?

Thanks.


Solution

  • There is now. Please update your copy of the SDK.

    https://github.com/versionone/VersionOne.SDK.Python/commit/be721a61e61dee297271e565f27ac7ba5a788a7a