Need to be able to calculate the total of column data in order to be used in reporting metrics

For the following table of records, I need to be able to calculate the total of the highlighted columns, (Bid Amount & Principle Balance) so that I can utilize that information to create a list of metrics listed below the Picture.

  • Balance Underwritten
    • Sum of Principle Balance
  • Balance Bid
    • Sum of Principal Balance (Where Bid Submitted? = Yes)
  • Balance Won
    • Sum of Principal Balance (where Bid Won? = Yes)
  • Bid to Underwritten %
    • Balance Bid divided by Balance Underwritten
  • Win to Bid %
    • Balance Won divided by Balance Bid
  • Win to Underwritten %
    • Balance Won divided by Balance Underwritten

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    a!localVariables(
      local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 20),
      local!balanceSum: a!refreshVariable(
        value: a!queryRecordType(
          recordType: 'recordType!{c98782ad-3fca-46e0-bba4-c6a8e2c71a2c}T Loan',
          fields: a!aggregationFields(
            groupings: a!grouping(
              field: 'recordType!{c98782ad-3fca-46e0-bba4-c6a8e2c71a2c}T Loan.fields.{776544e7-09aa-4079-b038-f3e274675ab5}id',
              alias: "id"
            ),
            measures: a!measure(
              field: 'recordType!{c98782ad-3fca-46e0-bba4-c6a8e2c71a2c}T Loan.fields.{02381417-037d-4868-bb86-0d812cc564f8}principalBalance',
              alias: "principalBalanceSum",
              function: "SUM"
            )
          ),
          pagingInfo: a!pagingInfo(
            startIndex: local!pagingInfo.startIndex,
            batchSize: local!pagingInfo.batchSize
          )
        ).data,
        refreshOnVarChange: local!pagingInfo
      ),
      {
        a!gridField(
          data:  a!recordData(
            recordType: 'recordType!{c98782ad-3fca-46e0-bba4-c6a8e2c71a2c}T Loan'
          ),
          columns: {
            a!gridColumn(
              label: "Loan",
              value: fv!row['recordType!{c98782ad-3fca-46e0-bba4-c6a8e2c71a2c}T Loan.fields.{1a71e16c-85b9-4882-8ab0-4af845f27271}loanName']
            ),
            a!gridColumn(
              label: "Balance",
              value: fv!row['recordType!{c98782ad-3fca-46e0-bba4-c6a8e2c71a2c}T Loan.fields.{02381417-037d-4868-bb86-0d812cc564f8}principalBalance']
            )
          },
          pageSize: 20,
          pagingSaveInto: { a!save(local!pagingInfo, fv!pagingInfo) },
          showSearchBox: false,
          showRefreshButton: false
        ),
        a!richTextDisplayField(
          value: {
            a!richTextItem(text: "Total Balance: ", style: "STRONG"),
            a!richTextItem(
              text: {
                a!currency(
                  value: sum(local!balanceSum.principalBalanceSum),
                  isoCode: "USD"
                )
              }
            )
          },
          align: "RIGHT"
        )
      }
    )

    Not sure if this is what you are trying to do. This example works with paging but doesn't support searching/sorting etc but it gives you an idea.

    If you wanted filters and such, you'll have to build them out yourself, you can't use the ones provided by recordData if you want sums and totals.

  • I dunno, it sounded to me a bit more like a matter of wanting to be able to take a sum of a column but not being able to figure out how to access the data property in the returned RecordType query, like I walked him through here.  But the detail provided was a little unclear, so who knows.

Reply Children
No Data