How to calculate sum of variable and move to global data

Hi everyone,
I have a user that is trying to do calculations on point (or cell) data, and then move the result into a global variable. For instance, the user wants to do the following:

# Code for ‘Script’

# ‘inputs’ is set to an array with data objects produced by inputs to

# this filter.

# Get the first input.

input0 = inputs[0]

# compute a value.

dataArray = sum(input0.PointData[“V”])

# ‘output’ is a variable set to the output dataset.

output.FieldData.append(dataArray, “V_sum”)

Any idea how do do this?

Thanks, Alan

I dont see anything wrong with that code. At first glance, it should work.

1 Like

Obviously, code is from user. Let me try it.