Query the SQL database base on the fields in the Infopath form and populate the result in repeating table - InfoPath Dev
in

InfoPath Dev

Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

Last post 02-01-2010 01:00 AM by dakesun. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-25-2008 02:13 PM

    Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

    I have a textbox which displays the current User. I got that part running. But now I want to query a different database which has the User field associated with it. I want to query the SQL database such that it returns the results in the dataset. And finally I want to populate the result in the dropdownlist or repeating table. Preferably dropdownlist. I am able to query the database and return the result in a textbox but I dont know how to populate data in dropdown list. Please Please help.I have search all the forms but no help.

  • 09-25-2008 11:06 PM In reply to

    Re: Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

    Hi Amar,

    You try to add the Data connection using Tools menu and connect to the DB and query the data which you want.

    Follow the below steps for populating the data into dropdown

    If the form template has multiple views, click View name on the View menu to go to the view with the control where you want to display the data from the secondary data source.

    1. Double-click the list box, drop-down list box, or combo box control that you want to populate.
    2. Click the Data tab.
    3. Under List box entries, click Look up values from an external data source.
    4. In the Data Source list, click the data source that you want to use.
    5. Click Select XPath next to the Entries box.
    6. Click a field and click on ok.
    7. If the field in the Display name box has values with similar display names, and you want to display only unique names, select the Show only entries with unique display names check box.
    Thanks,
    Sandhya


  • 09-26-2008 06:03 AM In reply to

    Re: Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

    The problem with my situation is, I want to filter the data connection based on the value in a textbox field on the infopath form. Let me explain what i did, I added a texbox a dropdown box and a button on the infopath form. Now the texbox fetches the value from a webservice for the userprofile. What i want is to populate the dropdownlist with data from a SQL data connection which is filtered based on the value in the textbox.

  • 10-01-2008 08:11 AM In reply to

    Re: Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

    Hi:

    This thread has a C# sample for modifying an Access query in a data connection in a form to use the value of another field in a 'where' clause and then run the query. You could use something like it in the Changed event for your text field, so that the value of the text field would be used in the 'where' clause for your SQL data connection. Then, if you used that data connection for the values and display for your dropdown, you should only have the values you want. Please note that SQL and Access use slightly different syntax, so you'll need to modify that.

    However, if the table associated with the SQL connection is not huge, you could always query automatically when the form loads and then use a filter on the fields for the drop down. When you select the field or group associated with your dropdown list, you have the option of filtering the data. You can select the textbox field and set it to "is equal' to whichever field in your SQL data connection has the match. This blog post has a great step by step that includes filtering for a combo box -- you may find it helpful as well.

    Hilary Stoupa

  • 02-01-2010 12:48 AM In reply to

    Re: Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

    Hi Hilary,

    I got a text box where i will be typing the 3 to 4 charaters and click search button to get the search results in the dropdown.

    I am struggling with the rule.

    Please tell me what rule i need to keep to working my button rule to work.

    Please assist urgently. Thanks in advance.

    The problem is

    The Infopath form is working perfectly fetching all the users in the active directory.

    I got like this

     Text box

    Search button

    Dropdown with all active directory users.

     In the button i kept the following action in the rule..

    1. Set a field's value as

    field = datasource is AD_User_Get_Users(Secondary)

    Queryfileds>InputProperties>Name

    Field = Name

    Value = concat(*,TextBoxField,*)

    amd also added a query

    Ad_User_Get_Users

    so i added 2 actions

    one is field value and second is query.

    but when on running, i can see users in the dropdown on loading form, when type something in text box and click search , i see the dropdown users vanish. so it is not searching by the textbox characters.

    Please assist me in configuring correct rule i need to use to get search results in the dropdown.

    Thanks

    Ravi

  • 02-01-2010 01:00 AM In reply to

    Re: Query the SQL database base on the fields in the Infopath form and populate the result in repeating table

    Hi Amar,

     did u get any solution for ur problem,

    i got the same problem, if u got solution please send me

    I got a text box where i will be typing the 3 to 4 charaters and click search button to get the search results.

    I am struggling with the rule.

    Please tell me what rule i need to keep to working my button rule to work.

    Please assist urgently. Thanks in advance.

    The problem is

    The Infopath form is working perfectly fetching all the users in the active directory.

    I got like this

     Text box

    Search button

    Dropdown with all active directory users.

     In the button i kept the following action in the rule..

    1. Set a field's value as

    field = datasource is AD_User_Get_Users(Secondary)

    Queryfileds>InputProperties>Name

    Field = Name

    Value = concat(*,TextBoxField,*)

    amd also added a query

    Ad_User_Get_Users

    so i added 2 actions

    one is field value and second is query.

    but when on running, i can see users in the dropdown on loading form, when type something in text box and click search , i see the dropdown users vanish. so it is not searching by the textbox characters.

    Please assist me in configuring correct rule i need to use to get search results in the dropdown.

     Thanks

    Ravi

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