IT tutorials
 
Technology
 

InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Create a Namespace Variable, Access the Secondary Data Source

1/26/2014 8:09:43 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

1. Create a Namespace Variable

Scenario/Problem:You need to create a namespace variable.

Solution:Declare a string variable and set that to the namespace using the NamespaceManager object.

Coding with InfoPath involves using XML/XPath objects and methods as well as XPath expressions. A key element in using the XML/XPath methods is the namespace that is used for the XML data retrieval. The NamespaceManager object enables you to look up the namespace. By default, the namespace in InfoPath data is my.

Because the namespace is used throughout various methods in this solution, the first line of code in the changed method is a string variable declaration, as shown in Listing 1.

Listing 1. Namespace Declaration
//Namespace variable
string myNamespace = NamespaceManager.LookupNamespace("my");

2. Access the Secondary Data Source

Scenario/Problem:You need to access the secondary data source.

Solution:Create DataSource and XPath objects using the secondary data source information.

The next step in the overall solution is to declare objects based on the secondary data source. You need the name of the secondary data source and the XPath of the rows that are returned. To retrieve the XPath of the rows returned, follow these steps:

1.
Switch over to your InfoPath form.

2.
In the Fields pane, switch the data source to the secondary data source. (For this example, it is Offices.)

3.
Expand the datafields folder.

4.
Right-click the repeating group under the datafields folder and select Copy XPath to copy the XPath string to the Clipboard, as shown in Figure 1.

Figure 1. Selecting Copy XPath places the XPath string into the Clipboard.

5.
Switch back to the code-behind and paste the XPath into the code as needed.

The secondary data source setup code is shown in Listing 2. Paste the XPath from the previous steps into the XPathNavigator Select method. Place this block of code after the namespace variable.

Listing 2. Secondary Data Source Setup
//Secondary data source setup DataSource ds = DataSources["OFFICES"]; XPathNavigator domNav = ds.CreateNavigator(); XPathNodeIterator rows = domNav.Select ("/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW", NamespaceManager);
 
Others
 
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Create a Changed Event Method
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Set Up the Initial Form
- Windows 7 : Managing Application Compatibility (part 6) - Installing and Configuring the Application Compatibility Toolkit
- Windows 7 : Managing Application Compatibility (part 5) - Using the Application Compatibility Toolkit - Compatibility Administrator , Internet Explorer Compatibility Test Tool
- Windows 7 : Managing Application Compatibility (part 4) - Using the Application Compatibility Toolkit - Application Compatibility Manager
- Windows 7 : Managing Application Compatibility (part 3) - Using the Program Compatibility Troubleshooter , Suppressing Compatibility Controls Using Group Policy
- Windows 7 : Managing Application Compatibility (part 2) - Evaluating Application Incompatibility Solutions - Using Compatibility Modes
- Windows 7 : Managing Application Compatibility (part 1) - Creating an Application Inventory
- Windows 7 : Designing an Application Deployment Strategy (part 3) - Deploying Applications - Selecting an Application Deployment Method
- Windows 7 : Designing an Application Deployment Strategy (part 2) - Deploying Applications - Using Server-Based Versus Client-Based Applications
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us