InfoPath: Conditional data display from an XML datasource

Posted on 2006-04-23
Medium Priority
Last Modified: 2013-11-19

I need advice on an XML issue on Infopath.

Listed below is a snippt of the XML file that will be reffered to in this post:

- <OpenView>
    - <data>
        - <entity key="11111" caption="Configuration Item">
             - <group caption="SERVER01">
                  <field key="C0" caption="Search code" type="String 50 uppercase (Searchcode)" width="91pt" align="left">SERVER01</field>
                  <field key="C1" caption="Type" type="Entity Reference" width="129pt" align="left">Backup Server</field>
                  <field key="C5" caption="Location" type="String 50 (Name)" width="129pt" align="left">NEW-YORK</field>
                   .  {meaning there are more fields}
        .  {meaning there are more fields}

I'm using an XML file as a datasource to my Infopath Form.
First, i've created a Combo-Box Control which lists the values of the 'group' tag's attribute 'caption' (for e.g. SERVER01).
What i want is after this selection is made, to display in various textboxes the valus of the 'field' tag.
For example:
after choosing 'SERVER01' in the combo box, the following textboxes will be fiiled:
Location: NEW-YORK
Type: Backup Server

I've manged to position myself in the correct subtree of 'group' using the xPath formula:
xdXDocument:GetDOM("SERVERS")/OpenView/data/entity/group/field[../../group/@caption = current()]
but when trying to add a condition to the rule, saying: caption (field's caption) == "Location" (to display the location) it didn't show nothing in the textbox.
when removing the condition, it did show the 1st value on field (which is the 1st row: SERVER01, when 'caption' is "Search Code" (and not Location).

Can you please assist in finding the right commands to achive this?

many thanks!!

Question by:edcic-admin

Author Comment

ID: 16569389
Amazingly so, i've found a solution by my own...
By using the function 'position()' i've manged to differ between the various field (OpenView/data/entity/group/field) instead of comparing it to its 'caption'
attribute which didn't work for some reason.

so, as for my question it's now solved.. i will probably need assitance on another infopath issue soon enough :)

thanks for now.
LVL 44

Accepted Solution

bruintje earned 600 total points
ID: 16577422
we should thank you for posting your solution :-)

you can ask a 0 point question for a refund here > http://www.experts-exchange.com/Community_Support/

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question