< SyntaxHighlightingPlugin >
<compute>[q9.2.1,B] + [q5.4.3,B]</compute> // voice B for building
<compute>([q9.2.1,B] / [q5.4.3,B]) + [t507.2.3,B]</compute>
< end SyntaxHighlightingPlugin >
The compute function with work with the index with aggregate functions like SUM, MAX, AVG, etc. If you see an aggregate function over a q (question) or t (table) reference, by default the operation is computed over all NONnull (answered) values across the indexes:
< SyntaxHighlightingPlugin >
<compute>SUM([qRoomSize,R])</compute> // Rooms are in an indexed voice R (room).
<compute>[t304.2]+AVG([t342.1.1.2,F])</compute> // t341.1.1.2 is a table with the indexed voice F (floor)
< end SyntaxHighlightingPlugin >
Or you could use aggregate functions across groups of questions, or XML question sets (different from Clips question sets, but the same concept)
< SyntaxHighlightingPlugin >
<set id=sFireSppression><name>Fire Suppression Types</name><items>q304.2, q304.3, q304.5, q304.7</items></set>
<compute>COUNT([t304.2])</compute> // Count the number differnt types of fire suppression used
<set id=sCommunication><name>Communication Questions</name><items>q200, q201, q202, q203, q204, q205, q206, q208, q212</items></set>
<compute>COUNT([sCommunication])>7<compute>
< end SyntaxHighlightingPlugin >
And you can as a dependency to an aggregate function, it will only compute for values that meet a given dependency AVE([qRoomSize,R],[qRoomType,R,qPublic]) // This finds the average size of rooms that are indexed, and only includes rooms that are qPublic COUNT([sCommunication],[pAgreement]) // compute the number of items in the sCommunication set that match the agree pattern
Evaluate
A similar idea to compute is a <evaluate ...> option. The idea is that this evaluates to True, False, or NA (not answered) much as <Compute> does numbers.
Patterns
Now if we can merely name our compute and evaluate functions, and then reference them as patterns, can we eliminate CLIPS? * refers to the question evoked on it
%CODE{"html"}%
[*,F,F]<=2 && [*,M,F]<=2  [*,M,F]>=4 && [*,M,M]>=4
 ...
