<?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: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/39037.aspx</link><pubDate>Sat, 28 Feb 2009 22:10:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39037</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39037.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=39037</wfw:commentRss><description>&lt;p&gt;Hey Ryan,&lt;/p&gt;
&lt;p&gt;Glad to hear you&amp;#39;ve discovered secondary data sources (2DSes). We love these for a variety of reasons (most because they&amp;#39;re fast and useful for meta data like guidance text, workflow status, etc.).&amp;nbsp;They do pose some limitations (eventing, validation, etc.). Check out our &lt;a class="" title="free qRules v1.5" href="http://www.infopathdev.com/files/folders/qrules/entry38856.aspx"&gt;free qRules download&lt;/a&gt; for commands that help you copy items from your 2DS to a main data source. Might help you keep them in synch. But, sounds like your approach of ID&amp;#39;ing them is also a good one. &lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/39032.aspx</link><pubDate>Sat, 28 Feb 2009 00:28:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39032</guid><dc:creator>Ryan Beesley</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39032.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=39032</wfw:commentRss><description>&lt;p&gt;I came up with an interesting solution using a secondary data source.&amp;nbsp; Essentially I created an XML file that was only used for display reasons.&amp;nbsp; I set it up as a receiving source and then oddly enough, I write values to that node.&amp;nbsp; This has bad results when used with a repeating table or section.&amp;nbsp; I could use some sort of keying mechanisim to bind the two sources, but if you might have node structures&amp;nbsp;reordering, it would be easy to get those out of sync.&lt;/p&gt;
&lt;p&gt;I believe the way I&amp;#39;m going to address this is to add a display node to the repeating section and write to that.&amp;nbsp; So as not to include that information when I write the data to disc, I will modify the tree on save to prune those nodes.&amp;nbsp; Not ideal, but I think it will work.&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/39023.aspx</link><pubDate>Fri, 27 Feb 2009 20:44:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39023</guid><dc:creator>Ryan Beesley</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39023.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=39023</wfw:commentRss><description>&lt;p&gt;Is it possible to put something into this expression box rather than retrieve it?&lt;/p&gt;
&lt;p&gt;Assume that I have something like the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;Name&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;First&amp;gt;Bob&amp;lt;/First&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;Last&amp;gt;Smith&amp;lt;/Last&amp;gt;&lt;br /&gt;&amp;lt;/Name&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;My goal is to create a display-only node with no binding, in this case I&amp;#39;d like to display &amp;quot;Smith, Bob&amp;quot;, or something to that effect.&amp;nbsp; An expression box makes the most sense, but I&amp;#39;ve also looked at trying to us an unbound textbox.&amp;nbsp; Unlike the example the xpath expression I&amp;#39;d have to write is far too complicated and it is something I should be able to do rather easily programatically, but are you saying there is no way to access this at runtime?&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21195.aspx</link><pubDate>Mon, 25 Jun 2007 10:29:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21195</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21195.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21195</wfw:commentRss><description>&lt;p&gt;Since there came no answers, I started looking for the answers myself. And eventualy I found the solution. It was a combination of Greg Collins &lt;a href="http://www.infopathdev.com/files/folders/examples/entry283.aspx"&gt;http://www.infopathdev.com/files/folders/examples/entry283.aspx&lt;/a&gt;&amp;nbsp;and &lt;font color="#800080" size="2"&gt;Matt Faus &lt;/font&gt;&lt;a href="http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Setup-Namespaces-for-a-Secondary-Data-Source.aspx"&gt;http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Setup-Namespaces-for-a-Secondary-Data-Source.aspx&lt;/a&gt;&amp;nbsp;that did the job. I would like to thank both of you for the provided help. For what it&amp;#39;s worth, this is the code &lt;/p&gt;&lt;p&gt;/*&lt;br /&gt;&amp;nbsp;* This file contains functions for data validation and form-level events.&lt;br /&gt;&amp;nbsp;* Because the functions are referenced in the form definition (.xsf) file, &lt;br /&gt;&amp;nbsp;* it is recommended that you do not modify the name of the function,&lt;br /&gt;&amp;nbsp;* or the name and number of arguments.&lt;br /&gt;&amp;nbsp;*&lt;br /&gt;*/&lt;/p&gt;&lt;p&gt;// The following line is created by Microsoft Office InfoPath to define the prefixes&lt;br /&gt;// for all the known namespaces in the main XML data file.&lt;br /&gt;// Any modification to the form files made outside of InfoPath&lt;br /&gt;// will not be automatically updated.&lt;br /&gt;// Added namespace according to Matt&amp;#39;s article&lt;br /&gt;//&amp;lt;namespacesDefinition&amp;gt;&lt;br /&gt;XDocument.DOM.setProperty(&amp;quot;SelectionNamespaces&amp;quot;,&amp;#39;xmlns:q=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/ado/queryFields"&gt;http://schemas.microsoft.com/office/infopath/2003/ado/queryFields&lt;/a&gt;&amp;quot; xmlns:d=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"&gt;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&lt;/a&gt;&amp;quot; xmlns:dfs=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"&gt;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&lt;/a&gt;&amp;quot; xmlns:my=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-19T11:16:40&amp;quot;&amp;#39;"&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-19T11:16:40&amp;quot;&amp;#39;&lt;/a&gt;);&lt;br /&gt;XDocument.GetDOM(&amp;quot;Approvers&amp;quot;).setProperty(&amp;quot;SelectionNamespaces&amp;quot;,&amp;#39;xmlns:ns1=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"&gt;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&lt;/a&gt;&amp;quot; xmlns:d1=&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;#39;"&gt;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;#39;&lt;/a&gt;)&lt;br /&gt;//&amp;lt;/namespacesDefinition&amp;gt;&lt;/p&gt;&lt;p&gt;// This function is added out of Greg&amp;#39;s example&lt;br /&gt;// To tell the truth: I don&amp;#39;t really know where this is about.&lt;br /&gt;// String object extension. Usage: stringObj.FunctionName([parameters]);&lt;br /&gt;// Example usage: &amp;quot;This is a {0}&amp;quot;.Format(&amp;quot;test.&amp;quot;); returns &amp;quot;This is a test.&amp;quot;;&lt;br /&gt;String.prototype.Format&amp;nbsp;= new Function(&amp;quot;var arg = String.prototype.Format.arguments; var str=this.toString(); var ph,re; for(var i=0;i&amp;lt;arg.length;i++){ph=new RegExp(&amp;#39;\{(&amp;#39;+i+&amp;#39;)\}&amp;#39;,&amp;#39;ig&amp;#39;); if(null==arg[i]) re=&amp;#39;&amp;#39;; else re=arg[i].toString(); str=str.replace(ph,re);} return str;&amp;quot;);&lt;/p&gt;&lt;p&gt;&lt;br /&gt;//=======&lt;br /&gt;// The following function handler is created by Microsoft Office InfoPath.&lt;br /&gt;// Do not modify the name of the function, or the name and number of arguments.&lt;br /&gt;// This function is associated with the following field or group (XPath): /dfs:myFields/my:Department&lt;br /&gt;// Note: Information in this comment is not updated after the function handler is created.&lt;br /&gt;//=======&lt;br /&gt;function msoxd_my_Department::OnAfterChange(eventObj)&lt;br /&gt;{&lt;br /&gt;// Write code here to restore the global state.&lt;/p&gt;&lt;p&gt;&amp;nbsp;if (eventObj.IsUndoRedo)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// An undo or redo operation has occurred and the DOM is read-only.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;// Retrieve department info into sSearchstring&lt;br /&gt;&amp;nbsp;var sSearchString = trim(XDocument.DOM.text);&lt;br /&gt;&amp;nbsp;// setup connection for EmployeeInfo&lt;br /&gt;&amp;nbsp;var oAdoAdapter = XDocument.DataObjects(&amp;quot;EmployeeInfo&amp;quot;).QueryAdapter;&lt;br /&gt;&amp;nbsp;//&amp;nbsp; construct select&lt;br /&gt;&amp;nbsp;var sCommand = &amp;quot;select EmployeeID, Lastname + &amp;#39; &amp;#39; +Firstname + &amp;#39; (&amp;#39; + EmployeeID + &amp;#39;)&amp;#39; as employeeinfo,orgunitdescr from dbo.EMPLOYEE where OrgUnitDescr = &amp;#39;&amp;quot; + sSearchString +&amp;quot;&amp;#39; and plantaa=&amp;#39;AA&amp;#39; order by employeeinfo&amp;quot;;&lt;br /&gt;&amp;nbsp;// apply appropriate select&lt;br /&gt;&amp;nbsp;oAdoAdapter.Command = sCommand;&lt;br /&gt;&amp;nbsp;// Requery the datasource&lt;br /&gt;&amp;nbsp;oAdoAdapter.Query();&amp;nbsp;&lt;br /&gt;//&amp;nbsp;XDocument.UI.Alert(&amp;quot;Please stop&amp;quot;)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;function trim(string) {&lt;br /&gt;&amp;nbsp; // retourneert de getrimde string (string ontdaan van leading en trailing whitespaces/tabs/newlines)&lt;br /&gt;&amp;nbsp; var remove = &amp;quot; \t\r\n&amp;quot;; // te verwijderen karakters&lt;br /&gt;&amp;nbsp; var ret = &amp;quot;&amp;quot;; // return string&lt;br /&gt;&amp;nbsp; var start = 0; // startpositie in de te controleren string&lt;br /&gt;&amp;nbsp; var end = string.length - 1; // eindpositie in de te controleren string&lt;/p&gt;&lt;p&gt;&amp;nbsp; // schuif de startpositie op&lt;br /&gt;&amp;nbsp; while(start &amp;lt;= end &amp;amp;&amp;amp; remove.indexOf(string.charAt(start)) != -1) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start++;&lt;br /&gt;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; // schuif de eindpositie op&lt;br /&gt;&amp;nbsp; while(end &amp;gt;= start &amp;amp;&amp;amp; remove.indexOf(string.charAt(end)) != -1) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end--;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // als string leeg is, geldt (end + 1 == start)&lt;/p&gt;&lt;p&gt;&amp;nbsp; // bouw de overgebleven string&lt;br /&gt;&amp;nbsp; for(i=start; i &amp;lt;= end; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret += string.charAt(i);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; return ret;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;//=======&lt;br /&gt;// The following function handler is created by Microsoft Office InfoPath.&lt;br /&gt;// Do not modify the name of the function, or the name and number of arguments.&lt;br /&gt;// This function is associated with the following field or group (XPath): /dfs:myFields/dfs:dataFields/d:LOCALSALES/@Approved_by1&lt;br /&gt;// Note: Information in this comment is not updated after the function handler is created.&lt;br /&gt;//=======&lt;br /&gt;function msoxd__LOCALSALES_Approved_by1_attr::OnAfterChange(eventObj)&lt;br /&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp;// Retrieve department info into sSearchstring&lt;br /&gt;&amp;nbsp;// I suppose eventObj.NewValue gets the information just entered. &lt;br /&gt;&amp;nbsp;var sName = eventObj.NewValue;&lt;br /&gt;&amp;nbsp;// Another 2 lines that are a mistery to me&lt;br /&gt;&amp;nbsp;var oRow = eventObj.Site.selectSingleNode(&amp;quot;..&amp;quot;);&lt;br /&gt;&amp;nbsp;var oSqlCustomer = XDocument.GetDOM(&amp;quot;Approvers&amp;quot;).selectSingleNode(&amp;quot;//d1:LOCALSALES_APPROVERS[@EmployeeID&amp;nbsp; = &amp;#39;{0}&amp;#39;]&amp;quot;.Format(sName));&lt;br /&gt;&amp;nbsp;var sSearchString = oSqlCustomer.getAttribute(&amp;quot;EmployeeEmail&amp;quot;)&lt;br /&gt;&amp;nbsp;// But the correct information shows up&lt;br /&gt;&amp;nbsp;XDocument.UI.Alert(sSearchString)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;if (eventObj.IsUndoRedo)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// An undo or redo operation has occurred and the DOM is read-only.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;/p&gt;&lt;p&gt;}&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Also thanks to davidair for the initial answers.&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21189.aspx</link><pubDate>Mon, 25 Jun 2007 07:54:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21189</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21189.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21189</wfw:commentRss><description>&lt;p&gt;What I bassicly want to do is retrieve an email address (field EmployeeEmail) from a secondary datasource based on&amp;nbsp;an EmployeeID (Field EmployeeID in table LOCALSALES_APPROVERS). The EmployeeID is entered as Approved_by1in the table LOCALSALES (=main data source).&lt;/p&gt;&lt;p&gt;Is there an easy understandable solution that a newbie like me can reproduce somewhere?&lt;/p&gt;&lt;p&gt;All my tables are in a SQL 2000 Database.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21187.aspx</link><pubDate>Mon, 25 Jun 2007 06:31:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21187</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21187.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21187</wfw:commentRss><description>&lt;p&gt;the code :&amp;nbsp; var sSearchString =XDocument.GetDOM(&amp;quot;Approvers&amp;quot;).selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:LOCALSALES_APPROVERS/@EmployeeEmail[../@EmployeeID = current()/@Approved_by1]&amp;quot;) &lt;/p&gt;&lt;p&gt;Returns the following error: Reference to undeclared namespace prefix: &amp;#39;dfs&amp;#39;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21157.aspx</link><pubDate>Fri, 22 Jun 2007 14:43:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21157</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21157.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21157</wfw:commentRss><description>&lt;p&gt;Yes, the only thing that won&amp;#39;t work in your code is xdXDocument:GetDOM() because you don&amp;#39;t have an XSLT processor where this function is defined.&lt;/p&gt;&lt;p&gt;However, there is an equivalent you can use in code:&lt;/p&gt;&lt;p&gt;XDocument&lt;font size="2"&gt;.GetDOM(&lt;em&gt;domName&lt;/em&gt;)&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;So your code then becomes this:&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;XDocument&lt;font size="2"&gt;.GetDOM&lt;/font&gt;&lt;font size="2"&gt;(&amp;quot;Approvers&amp;quot;).selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:LOCALSALES_APPROVERS/@EmployeeEmail[../@EmployeeID = current()/@Approved_by1]&amp;quot;)&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;(&amp;quot;Approvers&amp;quot;).selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:LOCALSALES_APPROVERS/@EmployeeEmail[../@EmployeeID = current()/@Approved_by1]&amp;quot;)&lt;/font&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21156.aspx</link><pubDate>Fri, 22 Jun 2007 14:13:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21156</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21156.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21156</wfw:commentRss><description>&lt;p&gt;Thanks for the response.&lt;/p&gt;&lt;p&gt;However I still have difficulties to access all data via code.&lt;/p&gt;&lt;p&gt;now I Retrieve the information into the expressionbox with the following statement.&lt;/p&gt;&lt;p&gt;xdXDocument:GetDOM(&amp;quot;Approvers&amp;quot;)/dfs:myFields/dfs:dataFields/d:LOCALSALES_APPROVERS/@EmployeeEmail[../@EmployeeID = current()/@Approved_by1]&lt;/p&gt;&lt;p&gt;Can someboy help me on how I get this into a variable?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21149.aspx</link><pubDate>Fri, 22 Jun 2007 12:45:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21149</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21149.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21149</wfw:commentRss><description>&lt;p&gt;The short answer is &amp;quot;no&amp;quot; - the expression box text is not stored in the data and you can only manipulate the data in the forms code.&lt;/p&gt;&lt;p&gt;The long answer is &amp;quot;well, it depends&amp;quot;. There are two possible things you can put into an expression box:&lt;/p&gt;&lt;p&gt;- an xpath xpression (as complex as you want)&lt;/p&gt;&lt;p&gt;- plain text&lt;/p&gt;&lt;p&gt;In the first case, you are&amp;nbsp;have to run&amp;nbsp;this xpath yourself in the proper context in your business logic (for example, if an expression box is summing up the columns of a particular row, get the xml node for that row and execute that xpath).&lt;/p&gt;&lt;p&gt;In the later case, when you have just typed it yourself, the value lives in the view.xsl. Then to retrieve it you can use the following approach: load up the view into an xml document, locate the span for the expression box and get the value out of it:&lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;font size="2"&gt; domObject = XDocument.CreateDOM();&lt;br /&gt;domObject.load(&amp;quot;view1.xsl&amp;quot;);&lt;br /&gt;domObject.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;#39;xmlns:xd=&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot; xmlns:xsl=&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot; xmlns:msxsl=&amp;quot;urn:schemas-microsoft-com:xslt&amp;quot;&amp;#39;);&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;font size="2"&gt; nodeObject = domObject.selectSingleNode(&amp;quot;//span[@xd:CtrlId=&amp;#39;CTRL1&amp;#39;]/xsl:value-of/@select&amp;quot;);&lt;br /&gt;XDocument.UI.Alert(nodeObject.text.substring(1, nodeObject.text.length - 1));&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;font face="Arial" size="2"&gt;However, it&amp;#39;s too much work for something that is very simple (it&amp;#39;s easier to just re-type the string in the code) so I am assuming you are really talking about the first scenario. In that case, once again, you really have to re-execute the xpath manually because opening the view xsl won&amp;#39;t help you - the value is dynamic and the &lt;strong&gt;runtime view cannot be accessed&lt;/strong&gt; in code.&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Accessing expressionbox information in code.</title><link>https://www.infopathdev.com:443/forums/thread/21146.aspx</link><pubDate>Fri, 22 Jun 2007 09:28:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21146</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21146.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21146</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;&amp;nbsp;Is it possible to retrieve the text entered in an expression box in the forms code?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks in advance&lt;/p&gt;</description></item></channel></rss>