<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How to display the right value, given a code entered b a user?</title><link>https://www.infopathdev.com:443/forums/thread/52817.aspx</link><pubDate>Wed, 17 Mar 2010 06:59:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52817</guid><dc:creator>MasterXPath</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52817.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=52817</wfw:commentRss><description>&lt;p&gt;/DataSource/Value[Code = current()] sounds ok, but does not work.&lt;/p&gt;
&lt;p&gt;I have tryed this, but then it dosn&amp;#39;t wright anything at all in the secong field.&lt;/p&gt;
&lt;p&gt;What I need to know i what instance of Code that is equal to the first field. And then have /DataSource/Value[&lt;em&gt;&amp;quot;instance of Code which = First field&amp;quot;&lt;/em&gt;]&lt;/p&gt;
&lt;p&gt;How do I get to know which instance of Codethat equals my first field?&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;My XML looks like this:&lt;/p&gt;
&lt;p&gt;&amp;lt;CodeListRows&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;CodeListRow&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Code&amp;gt;1234&amp;lt;/Code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Value1&amp;gt;New York&amp;lt;/Value1&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/CodeListRow&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;CodeListRow&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Code&amp;gt;4321&amp;lt;/Code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Value1&amp;gt;Miami&amp;lt;/Value1&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/CodeListRow&amp;gt;&lt;br /&gt;&amp;nbsp; ....&lt;br /&gt;&amp;lt;CodeListRows&amp;gt;&lt;/p&gt;
&lt;p&gt;What I want is to wright &amp;quot;Miami&amp;quot; in a textbox, when a user types 4321 in my inpufield. As said I do find the right code.&amp;nbsp;I don&amp;#39;t get to wright Miami, but always get New York. If user types 1234 I get New York (correct), If user types 4321 I get New York (wrong, should have been Miami), If user types 9999, I get nothing (correct).&lt;/p&gt;</description></item><item><title>Re: How to display the right value, given a code entered b a user?</title><link>https://www.infopathdev.com:443/forums/thread/52770.aspx</link><pubDate>Tue, 16 Mar 2010 14:21:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52770</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52770.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=52770</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t think you want to use substring here.&amp;nbsp; All you need is a simple XPath selection formula:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;/DataSource/Value[Code = current()] &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Or something along those lines. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to display the right value, given a code entered b a user?</title><link>https://www.infopathdev.com:443/forums/thread/52767.aspx</link><pubDate>Tue, 16 Mar 2010 14:03:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52767</guid><dc:creator>MasterXPath</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52767.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=52767</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m trying to display a value given a code entered by a user.&lt;/p&gt;
&lt;p&gt;Since I work with InfoPath 2007, it just support xPath 1.x, so to create a simple if-statement I constructed a rule like this:&lt;/p&gt;
&lt;p&gt;substring(Value1, 1, (. = Code) * string-length(Value1)) &lt;em&gt;// Value1 and Code is from a secondary datasource this secondary datasource is an XML &amp;quot;codelist&amp;quot; which should help me map a zipcode to a cityname. Code = 1234 =&amp;gt; Value1 = New York&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This xPath-expression, rule,&amp;nbsp;on one field do set a value in another field. In the first&amp;nbsp;field a user types a zip-code, which should end up as a cityname in the second field.&lt;/p&gt;
&lt;p&gt;My codelist would then be so that Code[1] = 1234, Value1[1] = New York; Code[2] = 4321, Value1[2] = Miami;&lt;/p&gt;
&lt;p&gt;The xPath expression above does find the code value, i.e. if I type &amp;quot;1234&amp;quot; in the first field the second field displays &amp;quot;New York&amp;quot;. I guess it is able to find out that there actually is a code-node containing &amp;quot;1234&amp;quot;. If I type &amp;quot;4321&amp;quot; I would like&amp;nbsp;the second field to&amp;nbsp;display &amp;quot;Miami&amp;quot;, but i still displays &amp;quot;New York&amp;quot;. I guess it is able to find out that there is a Code-node containing &amp;quot;4321&amp;quot;, but it wrights the wrong Value1-node. (If I type a number that does not exist in the list it displays nothing, which is correct...)&lt;/p&gt;
&lt;p&gt;How to get the right Value1-node????&lt;/p&gt;</description></item></channel></rss>