<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Controls</title><link>https://www.infopathdev.com:443/forums/43.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Programmatically Insert a checkbox into a repeating table</title><link>https://www.infopathdev.com:443/forums/thread/80766.aspx</link><pubDate>Thu, 19 Jul 2012 00:48:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80766</guid><dc:creator>Aaroninau</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80766.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=80766</wfw:commentRss><description>Hi everyone,

i have a repeating table which contains a checkbox. The structure is 
&lt;br /&gt;&lt;br /&gt;
activitylogs(group)-&amp;gt; activityLog(repeating table)-&amp;gt; ongoing (checkbox)
&lt;br /&gt;
&lt;br /&gt;
I want to dynamically insert new row and assign the checkbox a value according to another filed value.
&lt;br /&gt;
I managed to insert the checkbox, but every time I assigned a value to the check box, I got an error. 
&lt;br /&gt;
The error message says 
&lt;br /&gt;&lt;br /&gt;
            System.InvalidOperationException
&lt;br /&gt;
            Schema validation found non-data type errors.

&lt;br /&gt;
&lt;br /&gt;
I googled around and applied the DeleteNil function but still no luck. 
&lt;br /&gt;
In the infopath designer, the datatype of the check box is True/False (boolean), value is FALSE when cleared and TRUE when checked

&lt;br /&gt;
The above is my code
&lt;br /&gt;&lt;br /&gt;
&lt;code&gt;
            XmlDocument doc = new XmlDocument();
&lt;br /&gt;
            XmlNode group = doc.CreateElement(&amp;quot;my:activityLog&amp;quot;, NamespaceManager.LookupNamespace(&amp;quot;my&amp;quot;));
&lt;br /&gt;
            XmlNode field = doc.CreateElement(&amp;quot;my:ongoing&amp;quot;, NamespaceManager.LookupNamespace(&amp;quot;my&amp;quot;));
&lt;br /&gt;
            XmlNode node = group.AppendChild(field);
&lt;br /&gt;
            node.InnerText = &amp;quot;TRUE&amp;quot;;
&lt;br /&gt;
            doc.AppendChild(group);
&lt;br /&gt;
            XPathNavigator node2 = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:activityLogs&amp;quot;, NamespaceManager);
&lt;br /&gt;
            DeleteNil(node2);
&lt;br /&gt;
            node2.AppendChild(doc.DocumentElement.CreateNavigator());
&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;&lt;br /&gt;
Please help me out. Many Thanks!</description></item></channel></rss>