Conditional input read from XML file - InfoPath Dev
in

InfoPath Dev

Conditional input read from XML file

Last post 04-24-2006 10:02 AM by Matt Faus. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-20-2006 06:30 AM

    Conditional input read from XML file

    Hello,

    i'm trying to read data to textboxes from an XML file in the following fashion:
    i'm reading a certain tag value from the xml file into a COMBOBOX (list of server names).

    What i want is this: after choosing a certain name in the combo box i want to display certain values in textboxes, these values appear in a subtree in the xml file. meaning that i want to connect the values in the textbox to the specific choosen value in the combobox.

    Here is a snippet of the XML:
    - <group caption="BAGIRA">
    <field key="C0" caption="Search code">BAGIRA</field>
    <field key="C1" caption="Type">Print Server</field>
    <field key="C2" caption="Model">AXi</field>
    <field key="C3" caption="Location">MEXICO</field>
    </group>

    Example for the action:

    1. choose "BAGIRA" from the combo box (list of the group caption) & then displaying the following values in textboxes:
    Location: Mexico
    Type: Print Server
    Model: Axi

    Thank you
  • 04-20-2006 10:36 AM In reply to

    Re: Conditional input read from XML file

    Maybe this article will help:
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85
  • 04-23-2006 12:45 AM In reply to

    Re: Conditional input read from XML file

    Hi again,

    Thanks for the article, it really helped in understanding how can connect to the current XML tag choosen.
    However, i still some help in a condition i'm trying to meet in order to display the right data.

    Like i mentioned in the 1st message i've posted, i'm trying to display the values on a sub xml tree.
    here is the XML tree:
    - <entity caption="Configuration Item">
    - <group caption="SVR01">
    <field key="C0" caption="Search code">SVR01</field>
    <field key="C1" caption="Type">Backup Server</field>
    <field key="C2" caption="Model">ProLiant DL380 G3</field>
    <field key="C3" caption="Contract">HP01</field>
    <field key="C4" caption="OS">Windows 2000 Server</field>
    <field key="C5" caption="Location">BOMBAI</field>
    </group>
    - </entity>

    after reading the article i've manged to display the field value of a certain group caption (using xPATH function in a rule in the combobox control):
    xdXDocument:GetDOM("XML DATASOURCE")/entity/group/field[../../group/@caption = current()]
    but when i tried to add condition to the rule: "caption == "Location" (/field/caption) in hope that the location "BOMBAI" will be displayed in the target txtbox it didn't work.
    however when removing the condition, it did show the 1st field value "SVR01".

    Anyone knows the correct syntax for this conditioning?

    thanks,
  • 04-24-2006 10:02 AM In reply to

    Re: Conditional input read from XML file

    I think this should do the trick:

    xdXDocument:GetDOM("XML DATASOURCE")/entity/group/field[../../group/@caption = current() and ./@caption = "Location"]

    If this doesn't work, could you paste the XPath you tried so we can debug it?
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.