Hi JR,
Sorry for the delay as I was unexpectedly out of the office.
See if these steps work in your scenario:
- Modify your sample XML file to the following:
<?xml version = "1.0" ?>
<Rates>
<Rate>
<Display>Item 1</Display>
<Value>6</Value>
<myKey>6-Item 1</myKey>
</Rate>
<Rate>
<Display>Item 2</Display>
<Value>8</Value>
<myKey>8-Item 2</myKey>
</Rate>
<Rate>
<Display>Item 3</Display>
<Value>6</Value>
<myKey>6-Item 3</myKey>
</Rate>
</Rates>
- Create a new, blank InfoPath solution
- Add a "Receive" data connection to the above referenced XML file
named:
TestXML
- Add a drop-down list and text box to the form
- Right-click on the drop-down box and choose Properties
- Set the data connection of this control to: TestXML
- Click the Select XPath button next to Entries, select "Rate" and
click OK
- Click the button next to Value Field, select myKey and click OK
- You can leave Display name as: Display
- Click OK to close this Property window
- Right-click on the text box control and choose Properties
- Click the "fx" button next to the Value field for the Default Value
- Click Insert Field or Group
- From the Data Source box choose: TestXML
- Drill down, highlight Value (under Rate) and click the Filter Data
button
- Click Add
- From the first box, choose: myKey
- From the second box, choose: is equal to
- In the last box, choose: Select a field or group
- From the Data source box, choose: Main, highlight your drop-down
list box
field and click OK
- Click OK 3 times to get back to the Insert Formula window - you
should
basically see this: Value[myKey = field1]
- Modify this now to: Value[myKey = field1] * 10 (just to do some
mathematical function)
- Click OK 2 times to get back to your form
- Preview and test - you should be able to select any of the items in
the
list and the result in the text box should change appropriately
Let me know if this works for you!!
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq2\fcha
rset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs20 Hi JR,
\par
\par Sorry for the delay as I was unexpectedly out of the office.
\par
\par See if these steps work in your scenario:
\par
\par - Modify your sample XML file to the following:
\par
\par <?xml version = "1.0" ?>
\par <Rates>
\par <Rate>
\par <Display>Item 1</Display>
\par <Value>6</Value>
\par <myKey>6-Item 1</myKey>
\par </Rate>
\par <Rate>
\par <Display>Item 2</Display>
\par <Value>8</Value>
\par <myKey>8-Item 2</myKey>
\par </Rate>
\par <Rate>
\par <Display>Item 3</Display>
\par <Value>6</Value>
\par <myKey>6-Item 3</myKey>
\par </Rate>
\par </Rates>
\par
\par - Create a new, blank InfoPath solution
\par - Add a "Receive" data connection to the above referenced XML
file named: TestXML
\par - Add a drop-down list and text box to the form
\par - Right-click on the drop-down box and choose Properties
\par - Set the data connection of this control to: TestXML
\par - Click the Select XPath button next to Entries, select "Rate"
and click OK
\par - Click the button next to Value Field, select myKey and click OK
\par - You can leave Display name as: Display
\par - Click OK to close this Property window
\par - Right-click on the text box control and choose Properties
\par - Click the "fx" button next to the Value field for the Default
Value
\par - Click Insert Field or Group
\par - From the Data Source box choose: TestXML
\par - Drill down, highlight Value (under Rate) and click the Filter
Data button
\par - Click Add
\par - From the first box, choose: myKey
\par - From the second box, choose: is equal to
\par - In the last box, choose: Select a field or group
\par - From the Data source box, choose: Main, highlight your
drop-down list box field and click OK
\par - Click OK 3 times to get back to the Insert Formula window - you
should basically see this: Value[myKey = field1]
\par - Modify this now to: Value[myKey = field1] * 10 (just to do some
mathematical function)
\par - Click OK 2 times to get back to your form
\par - Preview and test - you should be able to select any of the
items in the list and the result in the text box should change
appropriately
\par
\par Let me know if this works for you!!
\par
\par Scott L. Heim
\par Microsoft Developer Support
\par
\par This posting is provided "AS IS" with no warranties, and confers
no rights.
\par
\par }