programming4us
programming4us
WEBSITE

Microsoft SharePoint 2010 : InfoPath Forms Services - Accessing Data in InfoPath Forms (part 1)

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

One of the powerful features of InfoPath, especially when it comes to generating browser-based forms, is the ability to connect to additional data sources. We can reuse our earlier Demonstration Equipment Request form to see this in action.

  1. Open the EquipmentRequest.xsn file from the local file system. Our form has two sections: the top section captures customer details and the bottom section captures a list of products. Rather than manually keying in customer details, we’ll make use of a SQL Server database to look up the required information and automatically populate the fields.

    Tip

    For demonstration purposes, SQL connections are easiest to use. However, their usefulness within InfoPath forms is pretty limited. Passing parameters generally requires custom code, as you’ll see later. As a general rule, the best way to communicate with external data sources is to create a custom web service interface. InfoPath can then parse the Web Service Definition Language (WSDL) and create fields for any parameters that may be required.


    To provide some sample data to work within our various examples, we need to download and install the SQL Server 2008 sample databases, which can be found at www.codeplex.com/MSFTDBProdSamples. Our examples make use of the AdventureWorksLT database installed on the local instance of SQL Server 2008.

  2. At the bottom of the Customer Details section, add a button. Buttons and other controls can be found in the Controls section of the Home ribbon. Type the button label as Find Customer.

  3. To add a data connection, switch to the Data tab on the ribbon, and then click From Other Sources | From Database, as shown:

  4. Click Select Database to select from the data sources that are available on the current machine. If one is not available for the AdventureWorksLT database, click New Source to add one. Select the Customer table when prompted. Once the data connection has been made, the columns will be listed, as shown next:

  5. Since we want to use a query to extract data from more than one table, click Edit SQL and enter the following SQL statement:

    Select            C.CustomerID,
    C.CompanyName,
    A.AddressLine1,
    A.AddressLine2,
    A.City,
    A.StateProvince,
    A.PostalCode
    From SalesLT.Customer as C
    Inner Join SalesLT.CustomerAddress as CA
    On CA.CustomerID=C.CustomerID
    Inner Join SalesLT.Address as A
    On A.AddressID=CA.AddressID

  6. Click Next. Leave the Store A Copy Of The Data In The Form Template checkbox unchecked. Click Next and then uncheck the Automatically Retrieve Data When Form Is Opened checkbox. Set the connection name to Customer and then click Finish to create the connection.

  7. We’ll make use of the Company Name field to search for customers. All other fields will be populated automatically from the search results. To make all other fields read-only, select the field and then from the Properties tab of the ribbon, check the Read-Only option in the Modify section. Repeat this process for all fields in the Customer Details section other than the Company Name field.

  8. We’ll display our search results on a separate page. From the Page Design tab’s Views section, select New. Name the new view Customer Search Results.

  9. Type the title of the new view as Customer Search and then, from the Fields pane, in the Fields drop-down, select Customer (Secondary). (The Fields drop-down is something of a misnomer. In reality, the drop-down contains a list of the data connections that are available to the current form.)

  10. Drag the d:Customer repeating group onto the Customer Search form. Select Repeating Table as the control type. When producing a schema from a SQL statement, InfoPath also adds columns for both sides of a join relationship. As a result, three redundant columns are named CustomerID1, AddressID, and AddressID1. To remove these from our repeating table, simply select the offending columns and choose Delete | Columns from the Layout tab.

  11. Since we don’t want the user to be able to edit the contents of these fields, using the Change Control button on the Properties menu that we demonstrated earlier, change the controls to Calculated Values.

  12. The final item that we need to add to our search form is a button to select the correct customer. Place the cursor in the first column of the table and then, from the Table tab in the ribbon, click Insert Left.

  13. Add a button in the data area of the new column and type the label as Select. The completed form should look like this:

Other  
  •  Extra-Curricular Activity - BMW 218d Active Tourer SE - An Engine That’s Fit For A Juke - Nissan Juke Tekna DIG-T (Part 1) - BMW 218d Active Tourer SE
  •  The Porsche Macan S Diesel 3.0 V6 – The Ultimate SUV You Can Drive (Part 2)
  •  Sharepoint 2010 : InfoPath Forms Services - InfoPath Overview (part 5) - Using InfoPath Forms in SharePoint - Creating Document Information Panels
  •  Sharepoint 2010 : InfoPath Forms Services - InfoPath Overview (part 4) - Using InfoPath Forms in SharePoint - Adding Formulae to Fields, Publishing a Form Template to SharePoint
  •  Sharepoint 2010 : InfoPath Forms Services - InfoPath Overview (part 3) - Using InfoPath Forms in SharePoint - Creating Form Templates
  •  Sharepoint 2010 : InfoPath Forms Services - InfoPath Overview (part 2) - BrowserForm Web Part
  •  Sharepoint 2010 : InfoPath Forms Services - InfoPath Overview (part 1)
  •  Sharepoint 2013 : List and library essentials - Sorting and filtering lists
  •  Sharepoint 2013 : List and library essentials - Using list and column validation rules
  •  Sharepoint 2013 : List and library essentials - Editing and deleting list columns
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us