Change a value in a field. - InfoPath Dev
in

InfoPath Dev

Change a value in a field.

Last post 07-01-2011 12:49 PM by joelundberg. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 06-29-2011 02:04 PM

    Change a value in a field.

    I am pulling in data from a SQL server. I have a base enum that consists of about 25 values. When I query on an item in InfoPath it will only give the numeric value of the base enum (I want it to give me the phrase that is tied to it.) I have tried adding rules with conditions but I am having no luck. Any Ideas????

  • 06-29-2011 04:43 PM In reply to

    Re: Change a value in a field.

    When you set up the SQL receive connection, did you include the "phrase" column?

    Patrick Halstead
    Project Manager at Qdabra
  • 06-30-2011 08:12 AM In reply to

    Re: Change a value in a field.

    The phrases are not in a column. The column consists of the numbers (base enums). Inside of the properties for the numbers are set values that the numbers are tied to.

  • 06-30-2011 09:51 AM In reply to

    Re: Change a value in a field.

    There are two things you can do here:

    1. Bind the field to a Dropdown Box and set up the combobox to have the appropriate display values correspond to all of the numerical "value" values.  You can make the dropdown readonly if you don't want anyone changing the value.
    2. Create a secondary data source from an XML file that has all of the phrases like this:
      <phrases>
          <phrase value="1">The phrase for 1</phrase>
          <phrase value="2">The phrase for 2</phrase>
      </phrases>
      And then use an Expression Box (called Calculated Value in IP 2010) to show the corresponding value using an XPath like this:

           /phrases/phrase[@value = current()/dbField]/phrase
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-30-2011 10:47 AM In reply to

    Re: Change a value in a field.

    Thanks Jimmy.

    I have created the secondary data source but I am having trouble with the XPath. This is all pretty new to me. What part of the XPath statement has to show my data? I keep getting this formula error ("/phrases/phrase/@value"does not point to a valid location path of a field or group.)

  • 06-30-2011 12:11 PM In reply to

    Re: Change a value in a field.

    You should use the Select field... button to pick the phrase field from the data source, then click Show XPath to add the [@value = current()] part.

    I made a mistake in the XPath in my previous post.  It should just be:

    /phrases/phrase[@value = current()/dbField]

    Naturally, you would replace dbField with the actual name of the field where that enumeration is stored.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-30-2011 01:15 PM In reply to

    Re: Change a value in a field.

    That worked but it pulls all the phrase values from the xml file I created. Any ideas?

  • 06-30-2011 09:10 PM In reply to

    Re: Change a value in a field.

    What do you mean when you say it pulls all the phrase values?  Could you attach a screenshot to this thread?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-01-2011 06:28 AM In reply to

    Re: Change a value in a field.

    -It pulls all the phrases from my xml file. The xml is below. It will list phrase 2,4,&11 in the expression box field. It should be pulling only 11.
           <phrases>
        <phrase value="2">The phrase for ALL</phrase>
        <phrase value="4">The phrase for 2</phrase>
        <phrase value="11">hello</phrase>
    </phrases>
    Here is my XPath statement:
          xdXDocument:GetDOM("test")/phrases[xdXDocument:GetDOM("test")/phrases/phrase/@value = current()/dfs:dataFields/d:RATABLE8D/@REASONCODE]
  • 07-01-2011 09:16 AM In reply to

    Re: Change a value in a field.

    Hello,

    I believe the XPath, when expanded, should look like this:

    xdXDocument:GetDOM("test")/phrases[@value = current()/dfs:dataFields/d:RATABLE8D/@REASONCODE]

    with just @value after the opening bracket.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-01-2011 10:31 AM In reply to

    Re: Change a value in a field.

    When I change it and click on verify formula it give me: @value" does not point to a valid location path of a field or group.

  • 07-01-2011 12:18 PM In reply to

    Re: Change a value in a field.

    Sorry, that should have been

    xdXDocument:GetDOM("test")/phrases/phrase[@value = current()/dfs:dataFields/d:RATABLE8D/@REASONCODE]

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-01-2011 12:49 PM In reply to

    Re: Change a value in a field.

    It works great.  Thank you very much!!

Page 1 of 1 (13 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.