<?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: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/45006.aspx</link><pubDate>Mon, 27 Jul 2009 15:40:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:45006</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/45006.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=45006</wfw:commentRss><description>&lt;p&gt;That worked!&amp;nbsp; Thank you for taking the time to help me out.&amp;nbsp; I was able to create my formula using the value returned from the stored procedure and I have the correct final value that I am expecting.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;I appreciate your help.&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44953.aspx</link><pubDate>Sat, 25 Jul 2009 02:58:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44953</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44953.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44953</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Once you have the value stored in the &lt;b&gt;rp&lt;/b&gt; variable you are free to manipulate it, perform calculations with it, or store it in a field in your main data source so it can be manipulated within the form:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;XDocument.DOM.selectSingleNode(&amp;#39;my:myFields/my:RemainingPays&amp;#39;).text = rp;&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44928.aspx</link><pubDate>Fri, 24 Jul 2009 18:48:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44928</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44928.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44928</wfw:commentRss><description>&lt;p&gt;My apologies.&amp;nbsp; I put it back and the command went through without error.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;I&amp;#39;m still not clear on how I can see the value that should be returned.&amp;nbsp; I&amp;#39;m trying to understand, so forgive me if&amp;nbsp;my question seems silly.&lt;/p&gt;
&lt;p&gt;I dont understand the var = rp... line that we entered.&amp;nbsp; This&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;#39;dfs:myFields/dfs:dataFields/d:row/@RemainingPays&amp;#39;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;looks to me like it is referencing a field in the forms datasource.&amp;nbsp; When I go to the SQL datasource, I don&amp;#39;t have &amp;quot;row&amp;quot; below dataFields, I just have the name of the table.&amp;nbsp; Do I need to setup a datasource using that path?&amp;nbsp; &lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44926.aspx</link><pubDate>Fri, 24 Jul 2009 18:32:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44926</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44926.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44926</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;If the P is capitalized here:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;dc.Command = &amp;#39;DECLARE @remainingPays smallint &amp;#39; + &amp;#39;EXECUTE
&amp;quot;dbo&amp;quot;.&amp;quot;VCS_SP_Remaining_Pays&amp;quot; \&amp;#39;&amp;#39; + HireDateV + &amp;#39;\&amp;#39;, @Remainingpays
OUTPUT &amp;#39; + &amp;#39;SELECT @Remainingpays as Remaining&lt;span style="font-size:150%;color:Red;"&gt;P&lt;/span&gt;ays&amp;#39;;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then it should be capitalized here:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;var rp = ds.selectSingleNode(&amp;#39;dfs:myFields/dfs:dataFields/d:row/@Remaining&lt;span style="font-size:150%;color:Red;"&gt;p&lt;/span&gt;ays&amp;#39;).text; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There was really no need to change any of the capitalization from what I provided you in the first place. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44925.aspx</link><pubDate>Fri, 24 Jul 2009 18:24:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44925</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44925.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44925</wfw:commentRss><description>&lt;blockquote&gt;
&lt;p&gt;dc.Command = &amp;#39;DECLARE @remainingPays smallint &amp;#39; + &amp;#39;EXECUTE &amp;quot;dbo&amp;quot;.&amp;quot;VCS_SP_Remaining_Pays&amp;quot; \&amp;#39;&amp;#39; + HireDateV + &amp;#39;\&amp;#39;, @Remainingpays OUTPUT &amp;#39; + &amp;#39;SELECT @Remainingpays as RemainingPays&amp;#39;;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The only thing I changed from the code was making pays lowercase in @Remainingpays.&amp;nbsp; In the storedprocedure the &amp;quot;p&amp;quot; is lowercase.&amp;nbsp; The post from 30 min ago I just copy and pasted those 2 lines from your reply and forgot to change the &amp;quot;p&amp;quot;.&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44924.aspx</link><pubDate>Fri, 24 Jul 2009 18:16:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44924</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44924.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44924</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;The part that looks something like this:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;dc.Command = 
&amp;#39;DECLARE @remainingPays smallint &amp;#39;&lt;br /&gt;+
&amp;#39;EXECUTE &amp;quot;dbo&amp;quot;.&amp;quot;VCS_SP_Remaining_Pays&amp;quot; \&amp;#39;&amp;#39; + HireDateV + &amp;#39;\&amp;#39;, @remainingPays OUTPUT &amp;#39; &lt;br /&gt;+
&amp;#39;SELECT @remainingPays as RemainingPays&amp;#39;;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Did you copy it exactly, or did you modify it somehow?&lt;/p&gt;&lt;p&gt;And why is &amp;quot;Pays&amp;quot; capitalized in your post from 30 minutes ago&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;var rp = ds.selectSingleNode(&amp;#39;dfs:myFields/dfs:dataFields/d:row/@Remaining&lt;b&gt;Pays&lt;/b&gt;&amp;#39;).text;&amp;nbsp; &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;while it&amp;#39;s lowercase in your post from 10 minutes ago?&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;var rp = ds.selectSingleNode(&amp;#39;dfs:myFields/dfs:dataFields/d:row/@Remaining&lt;b&gt;pays&lt;/b&gt;&amp;#39;).text; &lt;/p&gt;
&lt;/blockquote&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44923.aspx</link><pubDate>Fri, 24 Jul 2009 18:08:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44923</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44923.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44923</wfw:commentRss><description>&lt;p&gt;I apologize if I dont completely understand.&amp;nbsp; @Remainingpays is set as the output in the stored procedure.&amp;nbsp; &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;set @Remainingpays = (select sum(1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --as Remainingpays&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Are you lookiing for a line of code out of the form code, or from the stored procedure?&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44922.aspx</link><pubDate>Fri, 24 Jul 2009 17:54:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44922</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44922.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44922</wfw:commentRss><description>&lt;p&gt;Where&amp;#39;s the part where you&amp;#39;re setting the query text?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44921.aspx</link><pubDate>Fri, 24 Jul 2009 17:52:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44921</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44921.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44921</wfw:commentRss><description>&lt;blockquote&gt;
&lt;p&gt;dc.Query(); &lt;/p&gt;
&lt;p&gt;var ds = XDocument.DataObjects[&amp;quot;PayPeriodsDataSource&amp;quot;].DOM; &lt;/p&gt;
&lt;p&gt;var rp = ds.selectSingleNode(&amp;#39;dfs:myFields/dfs:dataFields/d:row/@Remainingpays&amp;#39;).text; &lt;/p&gt;
&lt;p&gt;dc.Command = originalCommand;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// restore the original command to the data source&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44918.aspx</link><pubDate>Fri, 24 Jul 2009 17:43:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44918</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44918.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44918</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Could you paste the section where you are currently seting the query text?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44917.aspx</link><pubDate>Fri, 24 Jul 2009 17:35:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44917</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44917.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44917</wfw:commentRss><description>&lt;p&gt;I put the 2 var codes after dc.query() and got the error below.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The following error occurred:&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Object required&lt;br /&gt;File:script.js&lt;br /&gt;Line:43&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Line 43 is&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;var rp = ds.selectSingleNode(&amp;#39;dfs:myFields/dfs:dataFields/d:row/@RemainingPays&amp;#39;).text; &lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44914.aspx</link><pubDate>Fri, 24 Jul 2009 16:51:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44914</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44914.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44914</wfw:commentRss><description>&lt;p&gt;Up near the top of the JScript code, you should see a section where SelectionNamespaces is being defined.&amp;nbsp; You&amp;#39;ll need to add this line right after it:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;XDocument.DataObjects[&amp;quot;PayPeriodsDataSource&amp;quot;].DOM.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;#39;xmlns:dfs=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot; xmlns:d=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;#39;);
&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Once you&amp;#39;ve done that, you should be able to access the RemainingPays value after the query like this:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;var ds = XDocument.DataObjects[&amp;quot;PayPeriodsDataSource&amp;quot;].DOM;&lt;br /&gt;var rp = ds.selectSingleNode(&amp;#39;dfs:myFields/dfs:dataFields/d:row/@RemainingPays&amp;#39;).text;
&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44913.aspx</link><pubDate>Fri, 24 Jul 2009 16:09:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44913</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44913.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44913</wfw:commentRss><description>&lt;p&gt;I tried the code snippet you gave me and it executed without error.&amp;nbsp; Thank you for that.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Now the next step I need to figure out is how can take the value that is being returned, &lt;strong&gt;@Remainingpays&lt;/strong&gt;, and set it equal to, &lt;strong&gt;/my:myFields/my:RemainingPays&lt;/strong&gt;?&amp;nbsp; @Remainingpays is not a column in any table, otherwise I would create that datasource and set the field equal to it.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The end result is to have that RemainingPays value get multiplied by number to return the # of paid time off.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44886.aspx</link><pubDate>Fri, 24 Jul 2009 02:20:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44886</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44886.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44886</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;As I suspected, the form is not opening because of this line:&lt;/p&gt;

&lt;p&gt;&amp;nbsp;dc.Command = &amp;#39;execute &amp;quot;dbo&amp;quot;.&amp;quot;VCS_SP_Remaining_Pays&amp;quot; &amp;#39;, &amp;quot;{d \&amp;#39;&amp;quot; + HireDateV + &amp;quot;&amp;#39;}&amp;quot; &amp;#39;, &amp;#39; + Remainingpays + &amp;#39; output&amp;#39;;  &lt;/p&gt;

&lt;p&gt;&amp;nbsp;Here you have a comma where you should have a plus sign:&lt;/p&gt;

&lt;p&gt;&amp;nbsp;Remaining_Pays&amp;quot; &amp;#39;&lt;span style="color:Red;font-size:130%;"&gt;,&lt;/span&gt; &amp;quot;{d \&amp;#39;&amp;quot;&lt;/p&gt;
&lt;p&gt;And here you have two separate strings with nothing joining them:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;quot;&amp;#39;}&amp;quot;&lt;span style="background-color:Red;"&gt; &lt;/span&gt;&amp;#39;, &amp;#39;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;If you put plus signs in those two places, the form will open.&lt;/p&gt;&lt;p&gt;However, there are still a few issues.&lt;/p&gt;&lt;p&gt;After looking at the stored procedure I can see that your colleague has modified the stored procedure to accept HireDate as an nvarchar and convert it to a date, so that means you do not need the {d } bit anymore.&lt;/p&gt;&lt;p&gt;Also, you are passing in the value of the Remainingpays field, but the server will expect an SQL variable there since it is an output parameter.&lt;/p&gt;&lt;p&gt;Please try the following and let me know if the query executes without an error:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;dc.Command = 
&amp;#39;DECLARE @remainingPays smallint &amp;#39;&lt;br /&gt;+
&amp;#39;EXECUTE &amp;quot;dbo&amp;quot;.&amp;quot;VCS_SP_Remaining_Pays&amp;quot; \&amp;#39;&amp;#39; + HireDateV + &amp;#39;\&amp;#39;, @remainingPays OUTPUT &amp;#39; &lt;br /&gt;+
&amp;#39;SELECT @remainingPays as RemainingPays&amp;#39;;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Formula to calculate days off</title><link>https://www.infopathdev.com:443/forums/thread/44881.aspx</link><pubDate>Fri, 24 Jul 2009 01:10:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44881</guid><dc:creator>acarita</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44881.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=44881</wfw:commentRss><description>&lt;p&gt;yes.&amp;nbsp; It&amp;#39;s just a button that I labeled &amp;quot;Refresh&amp;quot; and attached the code to the On_Click event.&lt;/p&gt;</description></item></channel></rss>