<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Putting numeric values into nodes with VB code</title><link>https://www.infopathdev.com:443/forums/thread/14699.aspx</link><pubDate>Wed, 19 Jul 2006 17:17:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14699</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14699.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14699</wfw:commentRss><description>Thanks for sharing this. Yes - you must ALWAYS remove the xsi:nil attribute before providing a value to a field. If you clear the value of a field, and it is marked as cannot be blank, then you must add back the xsi:nil attribute or else the field will show an error in InfoPath.</description></item><item><title>Re: Putting numeric values into nodes with VB code</title><link>https://www.infopathdev.com:443/forums/thread/14698.aspx</link><pubDate>Tue, 18 Jul 2006 19:10:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14698</guid><dc:creator>Carolyn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14698.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14698</wfw:commentRss><description>&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;There's probably a valid reason for it, but alas, I have not further insights for you on this.&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;It has to do with nillable content.&lt;br /&gt;&lt;br /&gt;If I default a value, say "0", in the field, then I can easily fill the field in managed code. If there is no value in the field, then I cannot fill the field in managed code. Or, I remove the nil attribute first, then fill it.&lt;br /&gt;&lt;br /&gt;In this particular problem, assigning 0 as the default value is no problem whatsoever, and the field is read-only to the user. Thus, the problem is solved.&lt;br /&gt;&lt;br /&gt;Thanks for replying!</description></item><item><title>Re: Putting numeric values into nodes with VB code</title><link>https://www.infopathdev.com:443/forums/thread/14697.aspx</link><pubDate>Tue, 18 Jul 2006 17:02:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14697</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14697.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14697</wfw:commentRss><description>Its the mysteries of programming. Why something doesn't work until you try to show someone, or works one time and not another.&lt;br /&gt;&lt;br /&gt;There's probably a valid reason for it, but alas, I have not further insights for you on this.&lt;br /&gt;&lt;br /&gt;I'm glad its working now!</description></item><item><title>Re: Putting numeric values into nodes with VB code</title><link>https://www.infopathdev.com:443/forums/thread/14696.aspx</link><pubDate>Fri, 30 Jun 2006 23:22:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14696</guid><dc:creator>Carolyn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14696.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14696</wfw:commentRss><description>&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;Keep in mind that all values are stored as text in the XML file... It is the schema that determines the data type of that text value.&lt;br /&gt;So, when you enter ANY value from code, you do it the same way: &lt;br /&gt;thisXDocument.DOM.selectSingleNode("my:node").text = "999"&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;Greg, thank you very much for your reply. This subject has been driving me nuts. I set up a simple trial sandbox so I could test code snippets without messing up the main project.&lt;br /&gt;&lt;br /&gt;I have, as I said before, several text boxes defined as doubles. When trying to use the thisXdocument.DOM.selectSingleNode().text statement, I got the PCDATA is in nil content error. I was able to get around that with the method I posted above, in the sandbox.&lt;br /&gt;&lt;br /&gt;BUT BUT BUT&lt;br /&gt;&lt;br /&gt;I took it out of my simple trial sandbox and put it in my main program. Suddenly, the text goes into double defined text boxes without any problem. I don't need the remove named item statement. &lt;br /&gt;&lt;br /&gt;The code is now working just great, getting a number (as you said formatted like "11") into the double defined text box. &lt;br /&gt;&lt;br /&gt;rant WHY DID IT NOT WORK LIKE THAT BEFORE WHEN I FIRST TRIED IT??? /rant&lt;br /&gt;&lt;br /&gt;If you could kindly offer insight on that, I would be in your debt.</description></item><item><title>Re: Putting numeric values into nodes with VB code</title><link>https://www.infopathdev.com:443/forums/thread/14695.aspx</link><pubDate>Fri, 30 Jun 2006 17:54:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14695</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14695.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14695</wfw:commentRss><description>Keep in mind that all values are stored as text in the XML file... It is the schema that determines the data type of that text value.&lt;br /&gt;&lt;br /&gt;So, when you enter ANY value from code, you do it the same way: &lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("my:node").text = "999"&lt;br /&gt;&lt;br /&gt;Hope this helps.&lt;br /&gt;</description></item><item><title>Putting numeric values into nodes with VB code</title><link>https://www.infopathdev.com:443/forums/thread/12909.aspx</link><pubDate>Wed, 28 Jun 2006 23:22:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12909</guid><dc:creator>Carolyn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12909.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12909</wfw:commentRss><description>I have several text boxes in my InfoPath form that are defined as double precision, as well as other text boxes that are strings (text).&lt;br /&gt;&lt;br /&gt;In VB.net code, I can easily assign the value of a string text box:&lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("my:node").text = "Whatever"&lt;br /&gt;&lt;br /&gt;But, what if I want to assign a numeric value to one of the double numeric text boxes? I looked for something like:&lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("my:node").&lt;font color="red"&gt;Value&lt;/font id="red"&gt; = 999&lt;br /&gt;&lt;br /&gt;That does not work.&lt;br /&gt;&lt;br /&gt;What does work? I kept on getting an error like:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;'#PCDATA' is in nil content&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If I changed the text boxes to text (string), then everything worked great. But, I did not want them to be string data. I wanted numbers so I could calculate sums, etc.&lt;br /&gt;&lt;br /&gt;After a great deal of search, I found the answer. You have to first remove the "nil attribute". How?&lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("my:node").attributes.removeNamedItem("xsi:nil")  'all on one line&lt;br /&gt;&lt;br /&gt;MicroSoft has a KB article (826998) that describes this in jscript.&lt;br /&gt;&lt;br /&gt;&lt;a href='http://support.microsoft.com/kb/826998/en-us' target='_blank' title='http://support.microsoft.com/kb/826998/en-us'&lt;a target="_blank" href=http://support.microsoft.com/kb/826998/en-us&gt;http://support.microsoft.com/kb/826998/en-us&lt;/a&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Added later (7/3/2006)&lt;br /&gt;&lt;br /&gt;After some trial and error, I discovered that if I set the decimal defined text boxes to have a default value (zero in my particular case), then I did not have to worry about the PCDATA is in nil content problem at all. I did not have to remove atribute at all. Setting a default value solved the problem for me.&lt;br /&gt;&lt;br /&gt;If you cannot or do not wish to set a default value, or if you are concerned about the user deleting your default, then you need to check to see if there is a nil attribute, then remove it if it is there. That can be done with simple if then end if code.</description></item></channel></rss>