27. Create a List View for Reports

In this step, you will 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 will add and configure from the Toolbox. You will add two instances of the list view to your form. You will configure rules so that one list view displays items pending approval and the other displays items pending finance processing. Ultimately, you will 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 lists of items as opposed to a single item.
      Data SourceThe Expense Claim SmartObject should already be selected, but if it is not, use the ellipses to locate and select theExpense ClaimSmartObject.
      This is the SmartObject that you want to display on the list view.
      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 will 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 display value for the Requester (Value) and Approver (Value) columns to Requester and Approver.
    1. Now, you will 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, change the Text property to:
      Requester
      As a reminder, the Name value is the control identifier K2 uses in rules, etc. 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. Next, you will add a sum aggregate to the Total Amount column. This 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), then 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.
    2. FINISH the new view to return to the K2 Application elements page.
Review

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

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