<?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: RE: Creating Employee Code?</title><link>https://www.infopathdev.com:443/forums/thread/3804.aspx</link><pubDate>Thu, 18 Jan 2007 06:41:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3804</guid><dc:creator>lyntonS</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3804.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3804</wfw:commentRss><description>I have solve the code using the following solution. Hope that it helps others in search of similar:&lt;br /&gt;&lt;br /&gt;AS&lt;br /&gt;	SET NOCOUNT OFF;&lt;br /&gt;&lt;br /&gt;SELECT&lt;br /&gt;	@EmpCode = max(EmpCode)&lt;br /&gt;FROM&lt;br /&gt;	Employees&lt;br /&gt;WHERE&lt;br /&gt;	EmpCode like upper(substring(@Firstname,1,1)+substring(@Surname,1,1)) +'%'&lt;br /&gt;&lt;br /&gt;IF @EmpCode is null&lt;br /&gt;	set @EmpCode = upper(substring(@Firstname,1,1)+substring(@Surname,1,1)) + '001';&lt;br /&gt;ELSE&lt;br /&gt;BEGIN&lt;br /&gt;	DECLARE @EmpCodeNo int;&lt;br /&gt;	SET @EmpCodeNo = Cast(substring(@EmpCode,3,3) as int) + 1;&lt;br /&gt;	SET @EmpCode = upper(substring(@Firstname,1,1)+substring(@Surname,1,1)) + replicate('0',3-len(@EmpCodeNo)) + cast(@EmpCodeNo as varchar);&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;INSERT INTO</description></item><item><title>Re: RE: Creating Employee Code?</title><link>https://www.infopathdev.com:443/forums/thread/3803.aspx</link><pubDate>Tue, 09 Jan 2007 14:54:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3803</guid><dc:creator>nukkumatti</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3803.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3803</wfw:commentRss><description>Just a quick idea:&lt;br /&gt;&lt;br /&gt;You can use&lt;br /&gt;System.Environment.UserName.ToString() to get the account name of the currently logged in user.&lt;br /&gt;for John Smith it will be something like jsmith now all you need to do is split/cut this string so that you only have the first two letters left. To auto generate a number you can use the Math.Random method (you should be able to find examples about this in the msdn library).&lt;br /&gt;&lt;br /&gt;You can also iterate through your Active Directory accounts and generate your "employee code" for all in once. Search for AD or Active Directory in this forum and you should be able to find some helpful stuff.&lt;br /&gt;&lt;br /&gt;Hope this helps a bit</description></item><item><title>RE: Creating Employee Code?</title><link>https://www.infopathdev.com:443/forums/thread/1783.aspx</link><pubDate>Tue, 09 Jan 2007 08:46:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1783</guid><dc:creator>lyntonS</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1783.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1783</wfw:commentRss><description>Please could you help me with the following query? Help! I am a junior developer that has recently been 'let loose' on the voyage of discovery and exploration in the exciting field of InfoPath and C# Web Services connecting to a Sql Express Database, and have hit my first challenge. I hope that you could help.&lt;br /&gt;&lt;br /&gt;I wish to design a unique Employee Code comprised of the first letter of the Employee Name, followed by the first letter of the Surname and then three random assigned digits e.g. John Smith reads as JS001. How could I do this probably simple exercise? I am struggling to get around it. I need the Employee Code to be inserted into the Database using the web service. When the user queries the InfoPath Form he/ she will use this Employee Code. Also, when adding a new employee a Employee code will automatically be generated using the Surname and First Name Fields.&lt;br /&gt;</description></item></channel></rss>