InfoPath: Conditional data display from an XML datasource

Posted on 2006-04-23
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

    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

    we should thank you for posting your solution :-)

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

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
    My experience with Windows 10 over a one year period and suggestions for smooth operation
    Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now