Here is the XML node of the query template that defines rule and GU (see Template Query):
<Templates>
<Template Name="Activity" >
<Messages>
<Exists>Must have an activity.</Exists>
<NotExists>Should not have active activity.</NotExists>
<Cardinality>Number of activities should be correct.</Cardinality>
</Messages>
<Source>
<From>
CONTACT_CATEGORIES
</From>
<WhereFields>
<MapField Name="Contact_Number" Type="Integer" />
<ValueField Name="Valid_To" Condition="<" Value="[Now]" Type="Date" />
<ValueField Name="Activity" Condition="=" Attribute="Activity" Type="Varchar" >
<Control Caption="Activity:" Type="Combobox">
<Source>
<SelectFields>
<ValueField Name="Activity" />
<Field Name="Activity_Desc" />
</SelectFields>
<From>ACTIVITIES</From>
</Source>
</Control>
</ValueField>
<ValueField Name ="Activity_Value" Condition="=" Attribute ="Activity_Value" Type="Varchar" >
<Control Caption="Value:" Type="Combobox">
<Source>
<SelectFields>
<ValueField Name="Activity_Value" />
<Field Name="Activity_Value_Desc" />
</SelectFields>
<From>ACTIVITY_VALUES</From>
<WhereFields>
<ValueField Name="Activity" Condition="=" Attribute="Activity" Type="Varchar" />
</WhereFields>
</Source>
</Control>
</ValueField>
</WhereFields>
</Source>
</Template>
</Templates>