As discussed at http://www.sqlnotes.net/drupal5/index.php?q=node/2070#comment-9119, you can do something like the following to use more than one field of your children in your column equation.
Parents = mySum(IncludeField, children)
Function mySum(IncludeIt, x) ' Calculates the sum of the array x if IncludeIt is true
dim d, i
d=ubound(x)
for i=0 to d
if IncludeIt(i)=true then mySum = mySum+NZ(x(i))
next
end Function
So the function is passed arrays of children's field values for IncludeField and whatever field the equation is defined in. Unfortunately this isn't what I need. What I would like to do is use the Parent's field in the equation. So I want something like this:
Parents = MyValueOrSum(ParentField, children) Function MyValueOrSum(myField, x)Dim d, iIf Not (IsNull(myField)) Then MyValueOrSum= myField Exit Function End If MyValueOrSum = Sum(x) End Function
Is this possible somehow?
d
Comments
Function MyValueOrSum(myField, x) Dim d, i d=ubound(x) for i=0 to d If Not (IsNull(myField(i))) Then MyValueOrSum= MyValueOrSum+NZ(myField(i))+NZ(x(i)) End if next End FunctionFunction mySum(IncludeIt, x) ' Calculates the sum of the array x if IncludeIt is true + shows result in parent only if parent itself satisfies condition dim d, i d=ubound(x) If IncludeIt(d) <> true then 'Leave parent's content intact if condition isn't met for that parent mySum = x(d) else 'Replace parent's content by the result of the column equation. for i=0 to d-1 if IncludeIt(i)=true then mySum = mySum+NZ(x(i)) next end if end Function