salesforcer (version 0.2.2)

format_report_row: Format a single "rows" element from a report fact map

Description

This function accepts a list representing a single row from a report and selects either the value or label for the report columns to turn into a one row tbl_df that will usually be bound to the other rows in the report

Usage

format_report_row(
  x,
  labels = TRUE,
  guess_types = TRUE,
  bind_using_character_cols = FALSE
)

Arguments

x

list; a single element from the rows element of a fact map. When the data is in a tabular format, this element usually has the same length as the number of columns with each element having a label and value element.

labels

logical; an indicator of whether the returned data should be the label (i.e. formatted value) or the actual value. By default, the labels are returned because these are what appear in the Salesforce dashboard and more closely align with the column names. For example, "Account.Name" label may be "Account B" and the value 0016A0000035mJEQAY. The former (label) more accurately reflects the "Account.Name".

guess_types

logical; indicating whether or not to use col_guess() to try and cast the data returned in the recordset. If TRUE then col_guess() is used, if FALSE then all fields will be returned as character. This is helpful when col_guess() will mangle field values in Salesforce that you'd like to preserve during translation into a tbl_df, like numeric looking values that must be preserved as strings ("48.0").

bind_using_character_cols

logical; an indicator of whether to cast the data to all character columns to ensure that bind_rows does not fail because two paginated recordsets have differing datatypes for the same column. Set this to TRUE rarely, typically only when having this set to FALSE returns an error or you want all columns in the data to be character.

Value

tbl_df; a single row data frame with the data for the row that the supplied list represented in the report's fact map.