<?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: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64741.aspx</link><pubDate>Wed, 02 Mar 2011 11:31:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64741</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64741.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64741</wfw:commentRss><description>Thanks for the reply


Column1[EmployeeID = cboNames]

So by referring to cboNames I am referring to the ID value itself. InfoPath automatically takes the first item of the combo box as the ID in this reference. That was what was confusing me.

I will try to use as little code as possible as that seems to be the general thinking here.

However, I am confused as to when I should use code, be it VB or XML.

If most things can be done without code then in what circumstances do we need to start writing any kind of code?</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64606.aspx</link><pubDate>Fri, 25 Feb 2011 17:47:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64606</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64606.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64606</wfw:commentRss><description>&lt;p&gt;Your post said &amp;quot;Combo Box&amp;quot; -- so I assumed you were using a combo box control (which allows the user to select or type in an entry).&lt;/p&gt;
&lt;p&gt;It may help you understand the&amp;nbsp;XPath filter to think of it this way:&amp;nbsp;Your secondary data source of PopulateEmployees has a lot of rows. You need to get a value from the Column1 field for one of those rows. How can you tell InfoPath which row it is? By telling it the EmployeeID for the same row. Your Main Data Source has a field that has an EmployeeID in it. The XPath says &amp;quot;Please provide me with a Column1 value from &lt;strong&gt;&lt;em&gt;this&lt;/em&gt;&lt;/strong&gt; row, the row where EmployeeID is equal to the ID of the item selected by my user&amp;quot;&lt;/p&gt;</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64603.aspx</link><pubDate>Fri, 25 Feb 2011 17:35:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64603</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64603.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64603</wfw:commentRss><description>Thanks for that - it is now working.

Although the logic seems a bit odd

Column1[EmployeeID = cboNames]

I presume this says select column1 from the combo box (display text) where the employee id (value ID) of the combo box equals the combo box (or some part of the combo box)

Can&amp;#39;t understand how that works, but it seems to.

As for them typing in a value - I assume as it is a dropdown they can only select what is available. But if they did type something in then the same principal would apply - I would need to select whatever has been typed.

Thanks</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64596.aspx</link><pubDate>Fri, 25 Feb 2011 16:39:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64596</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64596.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64596</wfw:commentRss><description>&lt;p&gt;To open the downloaded sample, right click on the XSN and select Design.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m going to ask again what you are doing in code -- is it something that simply can&amp;#39;t be acheived in the IP UI?&lt;/p&gt;
&lt;p&gt;If you are going to use code, you need to create a navigator for the secondary data source, then select the Column1 field where the EmployeeID matches the cboNames field (if that is the one bound to the combo box in question). Since this is a combo box, what will you do for the instances where a user types in &amp;quot;John Smith&amp;quot; rather than selecting from the existing options?&lt;/p&gt;</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64582.aspx</link><pubDate>Fri, 25 Feb 2011 10:43:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64582</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64582.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64582</wfw:commentRss><description>Ok I got a bit further, but it still does not give me anything other than the ID. My mistake was that I was taking the main data source rather than selecting from the dropdown of available data sources. Now I can see the fields available in the combo box I am using. 

What I am trying to achieve is to pick up the selected text in the combo box which I could use elsewhere in code.

Very easy to do in MS Access by taking the after update event of the dropdown and picking up the text value of the dropdown. Very easy to do in VB.Net by taking the text or selectedtext value of the dropdown and binding to a variable.

Not immediately easy though in InfoPath it seems.</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64581.aspx</link><pubDate>Fri, 25 Feb 2011 10:10:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64581</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64581.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64581</wfw:commentRss><description>The other image I mean to attach contains the properties of the combo box.</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64580.aspx</link><pubDate>Fri, 25 Feb 2011 10:04:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64580</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64580.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64580</wfw:commentRss><description>Thanks for the reply.

After downloading your sample I was unable to open it - some message about domain level permission and it being needed to be open from the original location.

Anyway - I think I can see what you are saying. I have attached some screen shots of the issue. When following what you said - it works somewhat, but I still only get the ID appearing in the expression box.</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64570.aspx</link><pubDate>Thu, 24 Feb 2011 23:00:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64570</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64570.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64570</wfw:commentRss><description>&lt;p&gt;What may help is more info on what you are trying to accomplish.&lt;/p&gt;
&lt;p&gt;Since a secondary data source provides the values for your combo box, try this.&lt;/p&gt;
&lt;p&gt;On your form, put an expression box (calculated value in IP 2010). Set the value of this expression box to the field in your secondary data source that provides the data for your combo box.&lt;/p&gt;
&lt;p&gt;When you set the value, you&amp;#39;ll use Insert Field or Group from the Formula Editor, You can click Filter Data right after you select the field that is your Display for you combo box. For you filter, you&amp;#39;d use the field that is being used for the value of your combo is equal to the field the combo box is bound to.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m attaching a sample form.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d say you should try to avoid using code in InfoPath, especially as a newbie, unless you are a programmer and can use MSDN to help you understand the possibilities and pitfalls. Especially for something like this, that can be done using the UI (general retrieval of data from data sources). Of course, a certain amount depends on what your end goal is.&lt;/p&gt;</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64544.aspx</link><pubDate>Thu, 24 Feb 2011 16:25:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64544</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64544.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64544</wfw:commentRss><description>It&amp;#39;s hard to know when to use code, XML etc in InfoPath.

Thanks for the example, but as a newbie I am unsure how it is working.

Can you shed any light?

Thanks</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64542.aspx</link><pubDate>Thu, 24 Feb 2011 16:10:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64542</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64542.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64542</wfw:commentRss><description>&lt;p&gt;Is there a reason you&amp;#39;re trying to access the value using code?&lt;/p&gt;
&lt;p&gt;Perhaps this thread will prove helpful:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.infopathdev.com/forums/p/15194/53864.aspx#53864"&gt;http://www.infopathdev.com/forums/p/15194/53864.aspx#53864&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Anyone know how to get selected text from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64536.aspx</link><pubDate>Thu, 24 Feb 2011 13:20:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64536</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64536.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64536</wfw:commentRss><description>I can get the selected combo box ID by using

Dim fieldValue As String = nav.SelectSingleNode(&amp;quot;//my:cboNames&amp;quot;, NamespaceManager).Value

But how do I pick up the selected text?

Thanks.</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64499.aspx</link><pubDate>Wed, 23 Feb 2011 12:17:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64499</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64499.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64499</wfw:commentRss><description>Thanks.

It is coming from a secondary data source (web service).

But how do I refer to it in the XML for example?

This code will get me the ID which is great, but what needs changing in order to get the display value?

Dim fieldValue As String = nav.SelectSingleNode(&amp;quot;//my:cboNames&amp;quot;, NamespaceManager).Value</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64456.aspx</link><pubDate>Tue, 22 Feb 2011 15:58:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64456</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64456.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64456</wfw:commentRss><description>&lt;p&gt;If your combo box is populated from a secondary data source, you could get the &amp;quot;display&amp;quot; value from that, using the &amp;quot;value&amp;quot; from your combo box field as part of your XPath filter.&lt;/p&gt;
&lt;p&gt;If your combo box is simply hardcoded, with the values in the control itself, there is no way to get those display values in code.&lt;/p&gt;</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64453.aspx</link><pubDate>Tue, 22 Feb 2011 15:38:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64453</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64453.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64453</wfw:commentRss><description>I can now get the ID using the code you suggested.

Incidentally - how does one retrieve the display value instead of the id?

Is there something that needs adding or changing in this code in order to access the display value?

Dim nav As XPathNavigator = MainDataSource.CreateNavigator()
Dim fieldValue As String = nav.SelectSingleNode(&amp;quot;//my:field1&amp;quot;, NamespaceManager).Value</description></item><item><title>Re: How can I save the ID from a combo box?</title><link>https://www.infopathdev.com:443/forums/thread/64443.aspx</link><pubDate>Tue, 22 Feb 2011 14:04:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64443</guid><dc:creator>troy23</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64443.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=64443</wfw:commentRss><description>Forgot to mention - it is InfoPath 2007</description></item></channel></rss>