InfoPath: Conditional data display from an XML datasource


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!!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

edcic-adminAuthor Commented:
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.
we should thank you for posting your solution :-)

you can ask a 0 point question for a refund here >

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.