27. Create a List View for Reports

In this step, you begin creating views for a reporting form. The form has three views: two list views and an item view. The item view contains reporting controls that you add and configure from the K2 Designer - Toolbox. You add two instances of the list view to your form. You configure rules so that one list view displays items pending approval and the other displays items pending finance processing. Ultimately, you have a "dashboard" style reporting form from which you can view expense claim instance details.

  1. Create a new list view with the following settings:
    FieldValue
    NameExpense Claim List
    DescriptionRead-only list of expense claims.
    Category(leave default value unchanged)
    View TypeList View
    Data SourceExpense Claim SmartObject
    List MethodGet List Items
    Call this method when the form loadsNot checked
    1. Navigate to the Expense Claim > K2 Application elements page. Click New, then View.
    2. Configure the GENERAL settings for the new view as follows:
      FieldValueNotes
      NameExpense Claim List 
      DescriptionRead-only list of expense claims. 
      Category(leave default value unchanged) 
      View TypeList ViewList views show one or more items in a list as opposed to a single item.
      Data SourceThe Expense Claim SmartObject should already be the default. If it is not, use the ellipses to navigate to and select the Expense Claim SmartObject.
      The list view displays records from this data source.
      List MethodGet List ItemsThis is the default method used to populate the list.
      Call this method when the form loadsNot checked You do not want the list view to populate automatically whenever it loads. Instead, you define rules to populate the list with specific records.
  2. Create Labels and Controls for the following properties (do not allow list editing):
    • Title
    • Requester (Value)
    • Approver (Value)
    • Submit Date
    • Total Amount
    1. On the LAYOUT screen, click Create Labels and Controls.
    2. On the Create Labels and Controls screen, select the fields listed below. Do not allow list editing. Click OK to continue.
      • Title
      • Requester (Value)
      • Approver (Value)
      • Submit Date
      • Total Amount
  3. Rename the display value for the Requester (Value) and Approver (Value) columns to Requester and Approver.
    1. Rename two of the column headers to make them easier to read. Select the Requester (Value) column. Click the Header tab in the Properties pane and change the Text property to
      Requester.
      As a reminder, the Name value is the control identifier K2 uses in rules and as the system name. The Text value is what you see on the form.
    2. Select the Approver (Value) column, then change the Text property to
      Approver.
  4. Add a Sum aggregate for the Total Amount column.
    1. Add a sum aggregate. The aggregate provides a running total of expense claims to use as reference. Select the Total Amount column, then click the Column tab in the Properties pane. Locate the Sum aggregate (under the Aggregation heading) and click Add. K2 inserts a footer row with the sum aggregation.
  5. Resize the column widths appropriately. The view should look like the image below when complete. Finish the view.
    1. Adjust the width of the columns so that Title is the widest and the Submit Date and Total Amount columns are narrower. Hover over the dividing column lines until you see double arrows. Click and drag the divider to increase or decrease column width.Click inside table. You see the table widget appear above. Drag the resize bar to adjust the column widths.
    2. FINISH the new view to return to the K2 Application elements page.
Review

In this step, you created a read-only list view of expense claims. Later, you add two instances of this view to your reporting form. One view displays expense claims waiting for approval, while the other displays expense claims waiting for finance processing. You configure rules for the two list views at the form level. In the next step, you create a new item view, then add reporting controls from the toolbox.

Next Step: 28. Create an Item View for Reports
Expense Claim Application