Create new rows for all contacts in a model displayed in drawer component

Rob,

Thanks for the sub-condition query suggestion. I wrote the query but it still does not only show me contacts that do not have attended checked. The only way I have been able to only see contacts not attending is to put a filter on the Attendance object. However, the list of contacts just keep loading every time the page is called. There are over 100 records at this point. I am attaching the XML below perhaps you can see where I am going wrong. Thank you!


<pre> <models>
 <model id="StateProgram" limit="20" query="true" createrowifnonefound="false" sobject="Account">
 <fields>
 <field id="Id"/>
 </fields>
 <conditions/>
 <actions/>
 </model>
 <model id="NationalProgramActions" limit="20" query="true" createrowifnonefound="false" sobject="Action__c">
 <fields>
 <field id="Name"/>
 </fields>
 <conditions>
 <condition type="modelmerge" value="" field="Name" operator="=" model="StateProgram" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
 </conditions>
 <actions/>
 </model>
 <model id="NationalProgramAttendance" limit="20" query="true" createrowifnonefound="true" sobject="Attendance__c" doclone="" type="">
 <fields>
 <field id="Action_Name__c"/>
 <field id="Action_Name__r.Name"/>
 <field id="Attended__c"/>
 <field id="Contact__c"/>
 <field id="Contact__r.Name"/>
 <field id="Contact__r.Chapter__c"/>
 <field id="Contact__r.Chapter__r.Name"/>
 <field id="Contact__r.RecordTypeId"/>
 <field id="Contact__r.RecordType.Name"/>
 </fields>
 <conditions>
 <condition type="param" value="Id" field="Action_Name__r.State_Program__c" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
 <condition type="modelmerge" value="" field="Action_Name__c" operator="=" model="NationalProgramActions" enclosevalueinquotes="true" mergefield="Name" novaluebehavior="deactivate" state="filterableoff" inactive="true" name="Action_Name__c"/>
 </conditions>
 <actions>
 <action>
 <actions>
 <action type="setCondition" model="NationalProgramAttendance" condition="Action_Name__c" value="{{Action_Name__c}}"/>
 <action type="requeryModels" model="NationalProgramAttendance" behavior="standard">
 <models>
 <model>NationalProgramAttendance</model>
 <model>Contacts</model>
 </models>
 </action>
 <action type="custom" snippet="generatecontacts"/>
 </actions>
 <events>
 <event>row.created</event>
 </events>
 </action>
 </actions>
 </model>
 <model id="Contacts" limit="20" query="false" createrowifnonefound="false" sobject="Contact" doclone="" type="">
 <fields>
 <field id="Id"/>
 <field id="Chapter__c"/>
 <field id="Chapter__r.Name"/>
 </fields>
 <conditions>
 <condition type="param" value="Id" field="Chapter__r.ParentId" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
 <condition type="join" value="" operator="in" field="Id" logic="" mergefield="Id" novaluebehavior="deactivate" state="" inactive="false" enclosevalueinquotes="true" joinobject="Attendance__c" joinfield="Contact__c">
 <conditions>
 <condition type="fieldvalue" value="true" field="Attended__c" operator="!=" mergefield="Contact__c" novaluebehavior="deactivate" enclosevalueinquotes="false"/>
 </conditions>
 </condition>
 </conditions>
 <actions/>
 </model>
 </models>
 <components>
 <pagetitle model="NationalProgramAttendance">
 <actions/>
 <maintitle>{{Action_Name__c}}</maintitle>
 </pagetitle>
 <skootable showconditions="true" showsavecancel="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="NationalProgramAttendance" buttonposition="" mode="edit">
 <fields>
 <field id="Attended__c" type="" valuehalign=""/>
 <field id="Contact__c" valuehalign="" type=""/>
 <field id="Contact__r.Chapter__c"/>
 <field id="Action_Name__c" valuehalign="" type=""/>
 <field id="Contact__r.RecordTypeId"/>
 </fields>
 <rowactions>
 <action type="edit"/>
 <action type="delete"/>
 </rowactions>
 <massactions usefirstitemasdefault="true">
 <action type="massupdate"/>
 <action type="massdelete"/>
 </massactions>
 <views>
 <view type="standard"/>
 </views>
 </skootable>
 </components>
 <resources>
 <labels/>
 <javascript>
 <jsitem location="inlinesnippet" name="generatecontacts" cachelocation="false">var params = arguments[0];
var $ = skuid.$;
// Get references to our three important Models
var models = skuid.model.map();
var contacts = models.Contacts;
var proActions = models.NationalProgramActions;
var newAttendance = models.NationalProgramAttendance;
// Now, auto-generate a new Attendance record 
// for each Contact in this Account.
$.each(contacts.data,function(){
 var row = newAttendance.createRow({
 additionalConditions: [
 { field: 'Contact__c', value: this.Id, operator: '=', nameFieldValue: this.Name }
 ]
 });
});</jsitem>
 </javascript>
 <css/>
 </resources>
</skuidpage>
``` ```