CAML Query / Instructions |
This example shows a process that uses a CAML query to retrieve information from a SharePoint list and display the information on a web page.
Display a custom, ad hoc report of employee expenses.
SharePoint Column |
---|
EmployeeID |
Department |
ExpenseDate |
ExpenseType |
Amount |
InfoPath Field |
---|
EmployeeID |
Department |
ExpenseDate |
ExpenseType |
Amount |
On the CAML Query Builder Configuration window, do the following to set up a CAML query to retrieve employee expenses from the SharePoint list according to the options in the Find Expenses form. These instructions provide sample values based on the example process.
Field Name | Value |
---|---|
Site Url |
http://demo3:8000/ |
List Name |
ExpenseList |
Configured View Fields |
Use the right arrow button to move the following fields from the Possible View Fields list to the Configured View Fields list:
|
<Where> <And> <Eq> <FieldRef Name='EmployeeID' /> <Value Type='Text' >${/my:ExpenseDetails/my:EmployeeID}</Value> </Eq> <And> <Eq> <FieldRef Name='Department' /> <Value Type='Text' >${/my:ExpenseDetails/my:Department}</Value> </Eq> <And> <Eq> <FieldRef Name='ExpenseType' /> <Value Type='Text' >${/my:ExpenseDetails/my:ExpenseType}</Value> </Eq> <And> <Geq> <FieldRef Name='ExpenseDate' IncludeTimeValue='TRUE' /> <Value Type='DateTime' IncludeTimeValue='TRUE'>${/my:ExpenseDetails/my:FromDate}</Value> </Geq> <Leq> <FieldRef Name='ExpenseDate' IncludeTimeValue='TRUE' /> <Value Type='DateTime' IncludeTimeValue='TRUE'>${/my:ExpenseDetails/my:To}</Value> </Leq> </And> </And> </And> </And> </Where> <OrderBy> <FieldRef Name='ExpenseDate' Ascending='True' /> </OrderBy>
Field Name | Value |
---|---|
Order By - Columns |
ExpenseDate |
Order By - Sort Order |
Ascending |
SharePoint Column | InfoPath Field |
---|---|
EmployeeID |
EmployeeID |
Department |
Department |
ExpenseDate |
ExpenseDate |
ExpenseType |
ExpenseType |
Amount |
Amount |