<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Date calculation</title><link>https://www.infopathdev.com:443/forums/thread/1990.aspx</link><pubDate>Mon, 06 Mar 2006 17:46:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1990</guid><dc:creator>Rokp</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1990.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1990</wfw:commentRss><description>I got it !&lt;br /&gt;The Date Control &lt;b&gt;PrepaDatePlanif&lt;/b&gt; must be formated as "text" and not "date"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sub CTRL20_13_OnClick(eventObj)&lt;br /&gt;&lt;br /&gt;Dim ISOdebut&lt;br /&gt;Dim ISOfin&lt;br /&gt;Dim DATEdebut&lt;br /&gt;Dim DATEfin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set ISOdebut = XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDateReceptFichiers")&lt;br /&gt;&lt;br /&gt;DATEdebut = CDate(ISOdebut.text)&lt;br /&gt;&lt;br /&gt;DATEfin = Dateadd("d", 20, DATEdebut)&lt;br /&gt;&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDatePlanif").text = DATEfin&lt;br /&gt;&lt;br /&gt;End Sub</description></item><item><title>Re: Date calculation</title><link>https://www.infopathdev.com:443/forums/thread/1989.aspx</link><pubDate>Mon, 06 Mar 2006 15:39:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1989</guid><dc:creator>Rokp</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1989.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1989</wfw:commentRss><description>I made another try with a blank page and it works perfectly.&lt;br /&gt;&lt;br /&gt;It appears that this line :&lt;br /&gt;&lt;br /&gt;XDocument.DOM.setProperty "SelectionNamespaces", "xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-06T09:58:56"""&lt;br /&gt;&lt;br /&gt;...is very important.&lt;br /&gt;&lt;br /&gt;It contains : &lt;b&gt;2006-03-06T09:58:56&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I don't know why it makes the formular I made bugging, but I must find.&lt;br /&gt;&lt;br /&gt;An idea ??</description></item><item><title>Re: Date calculation</title><link>https://www.infopathdev.com:443/forums/thread/1988.aspx</link><pubDate>Mon, 06 Mar 2006 14:49:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1988</guid><dc:creator>Rokp</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1988.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1988</wfw:commentRss><description>Okay, thanks !!&lt;br /&gt;&lt;br /&gt;Well I rewrote something more simple :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Sub CTRL20_13_OnClick(eventObj)&lt;br /&gt;&lt;br /&gt;Dim ISOdebut&lt;br /&gt;Dim ISOfin&lt;br /&gt;Dim DATEdebut&lt;br /&gt;Dim DATEfin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set ISOdebut = XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDateReceptFichiers")&lt;br /&gt;&lt;br /&gt;DATEdebut = CDate(ISOdebut.text)&lt;br /&gt;&lt;br /&gt;DATEfin = Dateadd("d", 20, DATEdebut)&lt;br /&gt;&lt;br /&gt;ISOfin = Mid(DATEfin,7,4) &amp; "-" &amp; Mid(DATEfin,4,2) &amp; "-" &amp;Mid(DATEfin,1,2)&lt;br /&gt;&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDatePlanif").text = ISOfin&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The only thing that doesn't work corectly is the last line.&lt;br /&gt;Indeed, the following error does occur :&lt;br /&gt;&lt;b&gt;L'erreur suivante s'est produite :&lt;br /&gt;&lt;br /&gt;« #PCDATA » se trouve dans un contenu nul : &amp;lt;&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-11-09T18:14:58}PrepaDatePlanif&amp;gt;.&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-11-09T18:14:58}PrepaDatePlanif&amp;gt;.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Fichier :script.vbs&lt;br /&gt;Ligne:38&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;That's crazy, I'm about to find the answer...</description></item><item><title>Re: Date calculation</title><link>https://www.infopathdev.com:443/forums/thread/1987.aspx</link><pubDate>Mon, 06 Mar 2006 11:40:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1987</guid><dc:creator>Suresh Reddy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1987.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1987</wfw:commentRss><description>HI Rokp,&lt;br /&gt;&lt;br /&gt;Try out this link&lt;br /&lt;a target="_blank" href=http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1711&gt;http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1711&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope this will help You.</description></item><item><title>Date calculation</title><link>https://www.infopathdev.com:443/forums/thread/1184.aspx</link><pubDate>Mon, 06 Mar 2006 11:27:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1184</guid><dc:creator>Rokp</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1184.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1184</wfw:commentRss><description>Hi all !!&lt;br /&gt;&lt;br /&gt;You will probably blame me for asking that but I got problem(s) with date calculation with Infopath.&lt;br /&gt;&lt;br /&gt;I understand that you must use code for any calculation date and I'm a pretty monkey with VBScript.&lt;br /&gt;I hardly search on the net and found a lot of answers ... but my code don't work at all.&lt;br /&gt;&lt;br /&gt;The problem :&lt;br /&gt;2 dates controlers : "PrepaDateReceptFichiers" &amp; "PrepaDatePlanif"&lt;br /&gt;I want : "PrepaDatePlanif"= "PrepaDateReceptFichiers" + 20 days&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The solution I wrote (google wrote for me!):&lt;br /&gt;&lt;pre&gt;' Ce fichier contient des fonctions relatives à la validation de données et aux événements de niveau de formulaire.&lt;br /&gt;' Étant donné que les fonctions sont référencées dans le fichier de définition du formulaire (.xsf),&lt;br /&gt;' il est déconseillé de modifier leur nom,&lt;br /&gt;' ou le nom et le nombre d'arguments.&lt;br /&gt;&lt;br /&gt;' La ligne suivante est créée par Microsoft Office InfoPath pour définir les préfixes&lt;br /&gt;' de tous les espaces de noms connus dans le fichier de données XML principal.&lt;br /&gt;' Aucune modification aux fichiers de formulaire, effectuée en dehors de InfoPath,&lt;br /&gt;' ne sera mise à jour automatiquement.&lt;br /&gt;'&amp;lt;namespacesDefinition&amp;gt;&lt;br /&gt;XDocument.DOM.setProperty "SelectionNamespaces", "xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-06T09:58:56"""&lt;br /&gt;'&amp;lt;/namespacesDefinition&amp;gt;&lt;br /&gt;&lt;br /&gt;'=======&lt;br /&gt;&lt;br /&gt;Function ISOaVB(ISODateString)&lt;br /&gt;	Dim dtRetVal&lt;br /&gt;	dtRetVal = Null&lt;br /&gt;&lt;br /&gt;	If Trim(ISODateString) &amp;lt;&amp;gt; "" Then&lt;br /&gt;		dtRetVal = DateSerial(Mid(ISODateString, 1, 4), _&lt;br /&gt;			Mid(ISODateString, 6, 2), Mid(ISODateString, 9, 2))&lt;br /&gt;	End If&lt;br /&gt;&lt;br /&gt;	ISOaVB = dtRetVal&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;'=======&lt;br /&gt;&lt;br /&gt;Function VBaISO(ISODateString)&lt;br /&gt;	'?????&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;'=======&lt;br /&gt;&lt;br /&gt;Sub CTRL19_13_OnClick(eventObj)&lt;br /&gt;&lt;br /&gt;Dim ISOdebut&lt;br /&gt;Dim ISOfin&lt;br /&gt;Dim DATEdebut&lt;br /&gt;Dim DATEfin&lt;br /&gt;&lt;br /&gt;'Récupère la date "début" au format ISO&lt;br /&gt;ISOdebut = XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDateReceptFichiers")&lt;br /&gt;&lt;br /&gt;'Convertit la date ISO en date VBScript&lt;br /&gt;DATEdebut = ISOaVB(ISOdebut)&lt;br /&gt;&lt;br /&gt;'Ajoute 20 jours&lt;br /&gt;DATEfin = Dateadd("d", 20, ISOdebut)&lt;br /&gt;&lt;br /&gt;'Convertit la date VBScript en date ISO&lt;br /&gt;ISOfin = VBaISO(DATEfin)&lt;br /&gt;&lt;br /&gt;'Renvoie la date "fin" au format ISO&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDateReceptDocs") = ISOfin&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Sorry, this code contain a lot of french words.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Where the first problem is :&lt;br /&gt;this line :&lt;br /&gt;ISOdebut = XDocument.DOM.selectSingleNode("/my:mesChamps/my:GroupeInformations/my:DatesPrepa/my:PrepaDateReceptFichiers")&lt;br /&gt;make the code bug.&lt;br /&gt;&lt;br /&gt;Infopath tell me that there is an 'execution error', 'non-define variable' ... something like that.</description></item></channel></rss>