(This is actually both a suggestion and a question.)
In other words : inheritance or sum would "propagate" only when certain fields are ticked.
That would be great as it would prevent propagation of hierarchical sums/inheritance where it's not needed or not even... not wanted at all.
Comments
if OtherFieldImposingCondition = -1 then
ShowMax = Max(ThisFieldUsingFunction) ' calculates the max of the array x
else ShowMax = ""
end Function
FROM (¯qDone AS ParentDone RIGHT JOIN ((¯qProgressDate AS ParentProgressDate
Dim sql As String
sql = "update LastProgress left join ¯qStatus on LastProgress.ID1 = ¯qStatus.ItemID " + _
"set ¯qStatus.Status = LastProgress.Status, ¯qStatus.ItemID = LastProgress.ID1, ¯qStatus.FieldID = [ProgressStatus.FieldID], ¯qStatus.Modified = LastProgress.Modified, ¯qStatus.IDUser = LastProgress.IDUser " + _
"where ¯qStatus.Status is null or ¯qStatus.Status <> LastProgress.Status;"
DBEngine(0)(0).Execute (sql)
sql = "update LastProgress left join ¯qDone on LastProgress.ID1 = ¯qDone.ItemID " + _
"set ¯qDone.Done = LastProgress.ProgressDate, ¯qDone.ItemID = LastProgress.ID1, ¯qDone.FieldID = 81, ¯qDone.Modified = LastProgress.Modified, ¯qDone.IDUser = LastProgress.IDUser " + _
"where LastProgress.Status = ""Done"" and ¯qDone.Done is Null"
DBEngine(0)(0).Execute (sql)
End Function
This has been enhanced to pass parameters
e.g. If the InvoiceTotal field Hierarchy equation is set to:
- Parents = mySum(Billable (Children)
And the mySum is defined (in the VB Editor) as:
' The following functions can be used in Hierarchy calculations. Typically: parent = mysum (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
Then, the InvoiceTotal field-values will be include in the total if Billing = true
The sample database "Invoices" grid was updated to show this feature.
dim d, i
d=ubound(x)
for i=0 to d
if not isnull(x(i)) then
if (param1(i)=true OR param2(i)=true) and (i=0 or x(i)<myMin) then myMin=x(i)
end if
next
end Function
with 2 conditions (using the OR operator).dim d, i
d=ubound(x)
for i=0 to d
if not isnull(x(i)) then
if param1(i)=true and (i=0 or x(i)<myMin) then myMin=x(i)
end if
next
end Function
dim d, i
d=ubound(x)
myMin=null
for i=0 to d
if not isnull(x(i)) then
if param1(i)=true then
if isnull(myMin) then
myMin=x(i)
else
if x(i)<myMin then myMin=x(i)
end if
end if
end if
next
end Function
if (param1(i)=true or param2(i)=true) then
) : if I remove all sub items values in fields corresponding to param1 and 2 (so that they don't meet the condition anymore) --> function error.if (param1(i)=true or param2(i)=true) then
) : if I remove all sub items values in fields corresponding to param1 and 2 (so that they don't meet the condition anymore) --> function error.'-----------------------------------------------------------------
Function myMin2(param1,param2,x) ' calculates the min of the array x
dim d, i
d=ubound(x)
myMin2=null
for i=0 to d
if not isnull(x(i)) then
if (param1(i)=true or param2(i)=true) then
if isnull(myMin2) then
myMin2=x(i)
else
if x(i)<myMin2 then myMin2=x(i)
end if
end if
end if
next
end Function