XPath expression for autopopulating fields (DB connection) - InfoPath Dev
in

InfoPath Dev

XPath expression for autopopulating fields (DB connection)

Last post 10-24-2008 03:54 AM by Talax. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-22-2008 08:04 AM

    • Talax
    • Not Ranked
      Male
    • Joined on 10-20-2008
    • Czech Republic, Prague
    • Posts 5

    XPath expression for autopopulating fields (DB connection)

     Hello everyone,

     I have a main data connection to the one table, that I want to upload on SQL server. Data that will be uploaded I need to get from the secondary data source. And in this case, I woud like to use autopopulate function like Greg Collins described here http://www.infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85 But he uses there blank sheet and XML document source. What I would need to know is - how to use this method on a database connection, mainly the part with applying rules on drop-down list box..

     I will be verz thankful for any ideas.

     

  • 10-22-2008 09:29 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: XPath expression for autopopulating fields (DB connection)

    Hello,

    While taking the data connection you have to select ‘Database' in the place of XML Document. Then you will get the data from database.

    Your dropdown list box entries should be above database connection and point to the specific node.

    Based on requirement you have to apply your rule to set the value. If you give more details on database schema and main data source schema then we can help you how to set the rule.

    Hope this helps you

  • 10-23-2008 01:46 AM In reply to

    • Talax
    • Not Ranked
      Male
    • Joined on 10-20-2008
    • Czech Republic, Prague
    • Posts 5

    Re: XPath expression for autopopulating fields (DB connection)

     Hello Shiva,

    At first thank you for your answer.. What I would like to find out is how to apply the rule on drop-down list box.

    A have two connections to the two different tables in one DB (difference is only in tehir name) "Customer_Inf" has main connection and "Customer" secondary - they have exactly same atributes (columns). In Customer I want to find the data using atribute PersonalNumber in drop-down list box and autofil the rest of columns from the Costumer. Then these data upload to the Customer_Inf. What I have achieved till now is only upload PersonalNumber.

    My problem is that I don't know how to write the xPath formula. In drop-down list box properties/Rules/Add/Add action/Set a field's value/Value:

    for example I tried something like this:

    FIELD               VALUE
    ../@Firstname=../@FirstName[../@PersonalNumber = current()]

    but it unfortunately didn't work :(

     Tahnk you..

  • 10-23-2008 04:04 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: XPath expression for autopopulating fields (DB connection)

    Hello,

    Here are the steps to set a field value,

    1. Click on "fx" icon in Action window.

    2. Click on "Insert Field or Group" button in Insert Formula window.

    3. Select secondary data source setting value and click on ‘Filter Data' button.

    4. Click on ‘Add' button in Filter Data window.

    5. Select filter condition field in left side dropdown and second drop down value should be ‘equal to'.

    6. In third drop down select main data source selected node (filter on this field).

    Click on ‘OK' seven times

  • 10-24-2008 03:54 AM In reply to

    • Talax
    • Not Ranked
      Male
    • Joined on 10-20-2008
    • Czech Republic, Prague
    • Posts 5

    Re: XPath expression for autopopulating fields (DB connection)

     Hi Shiva,

     now I have to thank you very very very much. Your advice led to success. Especially the sixth step was fundamental for my task. It realy will make our work easer.

    Thank you one more time..

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.