<?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: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/38374.aspx</link><pubDate>Thu, 12 Feb 2009 19:58:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38374</guid><dc:creator>fredp613</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38374.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38374</wfw:commentRss><description>&lt;p&gt;Hi Hilary, I understand now.&amp;nbsp; However i&amp;#39;m having a problem with the Create Procedure statement. I created a new test database for this with two columns, 1 is called ID (primary key - autonumber) and the 2nd called TransNumber.&amp;nbsp; The table itself is named &amp;quot;Trans&amp;quot;.&amp;nbsp; In order to create the stored procedure, I created a query and selected TransNumber, then opened the SQL expression menu and entered the following:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Create Procedure GenerateTransNumber&lt;br /&gt;As&lt;br /&gt;Begin&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set NoCount On;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select NewID() as TransNumber;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;End&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please let me know where i went wrong with this.&lt;/p&gt;
&lt;p&gt;Thank you :)&lt;/p&gt;
&lt;p&gt;Fred&lt;/p&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/38370.aspx</link><pubDate>Thu, 12 Feb 2009 18:53:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38370</guid><dc:creator>fredp613</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38370.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38370</wfw:commentRss><description>&lt;p&gt;Basically, for the query part, I dont really understand what u mean when u say:&lt;/p&gt;
&lt;p&gt;&amp;quot;If you are storing your Ids in SharePoint or SQL, you can always run a query to retrieve the Ids and use a formula like Max(Id field) +1&amp;quot;&lt;/p&gt;
&lt;p&gt;Thanks again &lt;/p&gt;
&lt;p&gt;Fred&lt;/p&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/38369.aspx</link><pubDate>Thu, 12 Feb 2009 18:50:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38369</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38369.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38369</wfw:commentRss><description>&lt;p&gt;Actually, the blog post uses SQL, not SharePoint. &lt;/p&gt;
&lt;p&gt;So you created a new data connection to your database -- does it have an ID column? You should set the data connection to query when the form opens. Set a default value on the field in the main data source where you want your ID. The formula for that value should use the max function to get the max ID from the data returned by your data connection. Then add one to that.&lt;/p&gt;
&lt;p&gt;It sounds like you have a rule set on the box where you want to store the value. Rules are triggered when&amp;nbsp;a field changes. So you may want to set the rule on the Vendor Name field and the Before Tax Price field to set the value for the Contract Balance field.&lt;/p&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/38368.aspx</link><pubDate>Thu, 12 Feb 2009 18:40:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38368</guid><dc:creator>fredp613</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38368.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38368</wfw:commentRss><description>&lt;p&gt;Hi Hilary thanks alot for the quick reply, and I really enjoyed your blog post :)), however sadly I do not have a sharepoint license in my office :((&lt;/p&gt;
&lt;p&gt;There will be only one person using this form.&amp;nbsp; Since I do not have&amp;nbsp;a Sharepoint lisence in my office currently,&amp;nbsp;I am&amp;nbsp;using SQL only (Access DB).&amp;nbsp; &lt;/p&gt;
&lt;p&gt;I was able to create a data connection with my database.&amp;nbsp; My problem is that I do not&amp;nbsp;know&amp;nbsp;how to perform&amp;nbsp;the query so that when this user opens &lt;/p&gt;
&lt;p&gt;a new form, a new referenceID (pulled i guess from my database) will appear automatically on the form.&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Secondly, for the &amp;quot;contract balance&amp;quot; text box i created, it is part of a repeating table where this user&amp;nbsp;can add&amp;nbsp;multiple items to the purchase order.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;In the text&amp;nbsp;box i&amp;nbsp;inserted a rule (which includes a formula).&amp;nbsp; This rule&amp;nbsp;says &amp;quot;if vendorName = XYZ, then perform this&amp;nbsp;formula: 5000&amp;lt;--Contract total with XYZ minus&lt;/p&gt;
&lt;p&gt;sum(beforeTaxPrice)&amp;lt;--this field is part of the repeating table.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thank you so much ure time.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/38338.aspx</link><pubDate>Wed, 11 Feb 2009 19:39:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38338</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38338.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38338</wfw:commentRss><description>&lt;p&gt;Generating Id&amp;#39;s can get a bit tricky. You can find different approaches -- a lot of them use code. If you are storing your Ids in SharePoint or SQL, you can always run a query to retrieve the Ids and use a formula like Max(Id field) +1. However, this isn&amp;#39;t fool proof -- you can always have an issue of more than one form using the same Id depending on when you call it. I have a blog post &lt;a href="http://www.infopathdev.com/blogs/hilary/archive/2008/11/21/fun-with-sequential-form-ids-sql-and-sprocs.aspx"&gt;here&lt;/a&gt; with one approach to Ids.&lt;/p&gt;
&lt;p&gt;On your other issues, I think I&amp;#39;d need to know a lot more about what your data source looks like to be able to understand what you are trying to do. What field should have the calucluated value? What fields are being used in the calculation?&lt;/p&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/38260.aspx</link><pubDate>Mon, 09 Feb 2009 21:24:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38260</guid><dc:creator>fredp613</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38260.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38260</wfw:commentRss><description>&lt;p&gt;Hi, I was hoping to get some help.&amp;nbsp; I&amp;#39;m currently designing a custom purchase order form, and want to do the following:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;1. When the user loads the form, I want infopath to generate an ID (i.e TRANS2009001). &lt;/p&gt;
&lt;p&gt;2. I created a drop down list that connects to an SQL database (Access) with a list of all our suppliers.&amp;nbsp; I was able to create rules for when, for example, if the user selects Supplier 1, all of Supplier 1&amp;#39;s address information automatically populates.&amp;nbsp; However, I also created a field in the Itemized list section called &amp;quot;contract total&amp;quot;.&amp;nbsp; So lets say I have 20 suppliers with 20 different contracts, each contract has a different dollar amount.&amp;nbsp; Therefore when the user selects Supplier 1, not only the address will automatically be populated, but when he/she puts in an amount for a service, this &amp;quot;contract total&amp;quot; field will know to deduct the amount from its total original contract total.&amp;nbsp; I&amp;#39;ve already tried using formulas such as $5000 - sum(totalpretaxprice). Also tried to create rules but nothing works.&amp;nbsp; Please help me with this.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thank you for ure time&lt;/p&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14566.aspx</link><pubDate>Mon, 21 Aug 2006 14:41:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14566</guid><dc:creator>nukkumatti</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14566.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14566</wfw:commentRss><description>Hey Hendra,&lt;br /&gt;&lt;br /&gt;i would not use the solution with the GUID. I had the same issue once and used the GUID in one case but the second time i used a webservice to generate my ID starting from 1 to ... .&lt;br /&gt;In my opinion this is a better solution as you&lt;br /&gt;1. don't get these really messy 128bit hex numbers&lt;br /&gt;2. you can be absolutely sure that you will never have the same id twice&lt;br /&gt;&lt;br /&gt;Check out this link to see what I mean: &lt;a href='http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2102' target='_blank' title='http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2102'&lt;a target="_blank" href=http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2102&gt;http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2102&lt;/a&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Watch out, the code is in C#&lt;br /&gt;BTW: From which part of germany are you from ?</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14565.aspx</link><pubDate>Mon, 21 Aug 2006 08:10:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14565</guid><dc:creator>hendra.kusuma@gmail.com</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14565.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14565</wfw:commentRss><description>i try to generate random ID :&lt;br /&gt;&lt;br /&gt;how can i write in jscript?&lt;br /&gt;&lt;br /&gt;my code is :&lt;br /&gt;function ID(GUID) {&lt;br /&gt;var productNodes = XDocument.DOM.selectNodes("/dfs:myFields/tns:dataFields/tns:XUmmeldProcessRequest/tns:DocumentPrefs");&lt;br /&gt;productNode.XDocument.DOM.selectSingleNode("tns:GUID").text = Math.random()*1000;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;and it was not work..&lt;br /&gt;&lt;br /&gt;thanks for help......&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14564.aspx</link><pubDate>Fri, 09 Jun 2006 04:24:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14564</guid><dc:creator>merddyin</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14564.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14564</wfw:commentRss><description>Even though I see you already got an answer, the thing that worked for me was to setup a retrieve data connection from my forms library on my ID field. I then set a text field to do a count on the ID field and add 6000 to it. This gave me a starting number of 6000 and it increments automatically every time. Just an idea of another method.&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14563.aspx</link><pubDate>Tue, 30 May 2006 08:01:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14563</guid><dc:creator>mary_l</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14563.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14563</wfw:commentRss><description>Thanks Anuma for your help!&lt;br /&gt;&lt;br /&gt;It works just fine!</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14562.aspx</link><pubDate>Fri, 26 May 2006 10:24:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14562</guid><dc:creator>Anuma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14562.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14562</wfw:commentRss><description>Hi,&lt;br /&gt;You can also generate unique GUID in Load event using "Scriptlet.TypeLib" ActiveX object (if you are in JavaScript):&lt;br /&gt;&lt;br /&gt;var guid = &lt;br /&gt;new ActiveXObject("Scriptlet.TypeLib").guid.substring( 0, 38);&lt;br /&gt;&lt;br /&gt;or using System.Guid.NewGuid() method (if you are in .NET).&lt;br /&gt;&lt;br /&gt;Thanks.</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14561.aspx</link><pubDate>Fri, 26 May 2006 09:48:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14561</guid><dc:creator>mary_l</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14561.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14561</wfw:commentRss><description>Just realized that i have to use JScript to generate the GUID, but i cant get it to work. The code &lt;br /&gt;&lt;br /&gt;var id = System.Guid.NewGuid();&lt;br /&gt;&lt;br /&gt;just doesnt work. Is there another solution to this in JScript?</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14560.aspx</link><pubDate>Mon, 22 May 2006 14:41:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14560</guid><dc:creator>mary_l</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14560.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14560</wfw:commentRss><description>Hi!&lt;br /&gt;&lt;br /&gt;Thanks a lot for the tip! I havent tried it yet, but i think it is exactly what im looking for!</description></item><item><title>Re: automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/14559.aspx</link><pubDate>Mon, 22 May 2006 13:16:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14559</guid><dc:creator>Anuma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14559.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14559</wfw:commentRss><description>Hi,&lt;br /&gt;Check out this link.&lt;br /&lt;a target="_blank" href=http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=448&gt;http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=448&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I hope this will help for you.&lt;br /&gt;Thanks</description></item><item><title>automatically set form ID?</title><link>https://www.infopathdev.com:443/forums/thread/12870.aspx</link><pubDate>Mon, 22 May 2006 13:00:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12870</guid><dc:creator>mary_l</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12870.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12870</wfw:commentRss><description>Hi!&lt;br /&gt;&lt;br /&gt;Is there some kind of ID that is automatically created when you create, save or submit an Infopath form? And, in that case, is there a way to get this ID? &lt;br /&gt;&lt;br /&gt;I would like to have the filename of my forms set to unique ID's when submitting to a sharepoint library. And i cannot use a database. Is there any easy way to do this?</description></item></channel></rss>