Retrieve a list of available calculated metrics. The results will always include these default items:
id, name, description, rsid, owner, polarity, precision, type. Other attributes can
be optionally requested through the expansion field.
Usage
aw_get_calculatedmetrics(
company_id = Sys.getenv("AW_COMPANY_ID"),
rsids = NULL,
ownerId = NULL,
filterByIds = NULL,
toBeUsedInRsid = NULL,
locale = "en_US",
name = NULL,
tagNames = NULL,
favorite = NULL,
approved = NULL,
limit = 1000,
page = 0,
sortDirection = "DESC",
sortProperty = NULL,
expansion = NULL,
includeType = "all",
debug = FALSE
)Arguments
- company_id
Company ID. If an environment variable called
AW_COMPANY_IDexists in.Renvironor elsewhere and nocompany_idargument is provided, then theAW_COMPANY_IDvalue will be used. Useget_meto get a list of availablecompany_idvalues.- rsids
Filter the list to only include calculated metrics tied to a specified RSID or list of RSIDs. Specify multiple RSIDs as a vector (i.e., "
rsids = c("rsid_1", rsid_2",...rsid_n")"). Useaw_get_reportsuitesto get a list of availablersidvalues.- ownerId
Filter the list to only include calculated metrics owned by the specified loginId.
- filterByIds
Filter the list to only include calculated metrics in the specified list as specified by a single string or as a vector of strings.
- toBeUsedInRsid
The report suite where the calculated metric is intended to be used. This report suite is used to determine things like compatibility and permissions. If it is not specified, then the permissions will be calculated based on the union of all metrics authorized in all groups the user belongs to. If compatibility is specified for
expansion, andtoBeUsedInRsidis not, then the compatibility returned is based off of the compatibility from the last time the calculated metric was saved.- locale
The locale that system-named metrics should be returned in. Non-localized values will be returned for title, name, description, etc. if a localized value is not available.
- name
Filter the list to only include calculated metrics that contain the specified name. This is case-insensitive and is a simple, single string match.
- tagNames
Filter the list to only include calculated metrics that contain one of the tags as specified by a single string or vector of strings.
- favorite
Set to
TRUEto only include calculated metrics that are favorites in the results. A value ofFALSEwill return all calculated metrics, including those that are favorites.- approved
Set to
TRUEto only include calculated metrics that are approved in the results. A value ofFALSEwill return all calculated metrics, including those that are approved and those that are not.- limit
The number of results to return per page. The default is 1,000.
- page
The "page" of results to display. This works in conjunction with the
limitargument and is zero-based. For instance, iflimit = 10andpage = 1, the results returned would be 11 through 20.- sortDirection
The sort direction for the results:
ASC(default) for ascending orDESCfor descending. (This is case insensitive, soascanddescwork as well.)- sortProperty
The property to sort the results by. Currently available values are
id(default),name, andmodified_date. Note that settingexpansion = modifiedreturns results with a column added calledmodified, which is the last date the calculated metric was modified. When using this value forsortProperty, though, the name of the argument ismodified_date, because why would we expect locked-in consistency from Adobe?- expansion
Additional calculated metric metadata fields to include in the results:
reportSuiteName,ownerFullName,modified,tags,definition,compatability,categories. See Details for more information about the quirks of this argument.- includeType
Include additional calculated metrics not owned by user. Available values are
all(default),shared, andtemplates. Thealloption takes precedence over "shared"- debug
Include the output and input of the api call in the console for debugging. Default is FALSE
Details
This function is useful/needed to identify the specific ID of a calculated metric for use in other
functions like aw_freeform_report.
The expansion argument accepts the following values, which will then include additional columns
in the results:
ownerFullName: adds
owner.nameandowner.logincolumns to the results (owner.idis already included by default).modified: adds a
modifiedcolumn to the output with the date (ISO 8601 format) each calculated metric was last modified.definition: adds multiple columns (the number will vary based on the number and complexity of calculated metrics returns) that provide the actual formula for each of the calculated metrics. This is returned from the API as a JSON object and converted into columns by the function, which means it is pretty messy, so, really, it's not recommended that you use this value.
compatability: should add a column with the products that the metric is compatible with, but this behavior has not actually been shown to be true, so this may actually do nothing if included.
reportSuiteName: adds a
reportSuiteNameand asiteTitlecolumn with the friendly report suite name for the RSID.tags: adds a column with an embedded data frame with all of the existing tags that are associated with the calculated metric. This can be a bit messy to work with, but the information is, at least, there.
Multiple values for expansion can be included in the argument as a vector. For instance,
expansion = c("tags", "modified") will add both a tags column and a modified column to the output.
