Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aw_freeform_table(): undefined columns selected #154

Open
elalbaicin opened this issue Feb 11, 2023 · 7 comments
Open

aw_freeform_table(): undefined columns selected #154

elalbaicin opened this issue Feb 11, 2023 · 7 comments

Comments

@elalbaicin
Copy link
Contributor

elalbaicin commented Feb 11, 2023

Whenever I try to extract all data from February 8 or later, I run into the following issue. It may be specific to this company ID or report suite, but given it is the only one with which I work, I can't be sure. Has it happened before? Is there a way around it or something I should do?

If I make this aw_freeform_table() call:

aw_freeform_table(company_id = Sys.getenv("AW_COMPANY_ID"),
rsid = Sys.getenv("AW_REPORTSUITE_ID"),
date_range = c("2023-02-08", "2023-02-08"),
dimensions = c("daterangeday",
"evar105.3",
"mobiledevicetype",
"evar4.3",
"lasttouchchannel",
"evar2.3",
"evar1.5",
"evar3.3",
"product"),
metrics = c("productinstances",
"event83",
"revenue"),
top = c(1, 1, 4, 7, 16, 32, 50, 70, 10792),
page = 0,
filterType = "breakdown",
segmentId = "s1276_5fff77492b1c176b76b8aafc",
metricSort = "desc",
include_unspecified = TRUE,
search = NA,
prettynames = FALSE,
debug = FALSE,
check_components = FALSE)

I get this error:

Error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 3.
Caused by error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 9.
Caused by error in [.data.frame:
! undefined columns selected
Run rlang::last_error() to see where the error occurred.

And the traceback by rlang::last_error():

<error/purrr_error_indexed>
Error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 1.

Backtrace:

  1. global aw_freeform_table(...)
  2. purrr (local) <fn>(<prrr_rr_>)
  3. cli::cli_abort(...)

Caused by error in pmap():
ℹ In index: 1.
Caused by error in pmap():
ℹ In index: 1.

Backtrace:

  1. global aw_freeform_table(...)
  2. purrr (local) <fn>(<prrr_rr_>)
  3. cli::cli_abort(...)

Caused by error in pmap():
ℹ In index: 3.
Caused by error in pmap():
ℹ In index: 1.

Backtrace:

  1. global aw_freeform_table(...)
  2. purrr (local) <fn>(<prrr_rr_>)
  3. cli::cli_abort(...)

Caused by error in pmap():
ℹ In index: 9.
Caused by error in [.data.frame:
! undefined columns selected

Backtrace:

  1. global aw_freeform_table(...)
  2. global get_req_data(qs = query_spec, index = 1, item_ids = NULL, debug = debug)
    at adobeanalyticsr/R/freeform_report.R:208:2
  3. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  4. purrr::pmap(.l, .f, ...)
  5. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  6. .f(...)
  7. global get_req_data(...)
  8. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  9. purrr::pmap(.l, .f, ...)
  10. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  11. .f(...)
  12. global get_req_data(...)
  13. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  14. purrr::pmap(.l, .f, ...)
  15. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  16. .f(...)
  17. global get_req_data(...)
  18. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  19. purrr::pmap(.l, .f, ...)
  20. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  21. .f(...)
  22. global get_req_data(...)
  23. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  24. purrr::pmap(.l, .f, ...)
  25. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  26. .f(...)
  27. global get_req_data(...)
  28. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  29. purrr::pmap(.l, .f, ...)
  30. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  31. .f(...)
  32. global get_req_data(...)
  33. purrr::pmap_dfr(...)
    at adobeanalyticsr/R/get_req_data.R:90:4
  34. purrr::pmap(.l, .f, ...)
  35. purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
  36. .f(...)
  37. global get_req_data(...)
  38. base::[.data.frame(data$rows, , c("itemId", "value"))
    at adobeanalyticsr/R/get_req_data.R:85:4
  39. base::stop("undefined columns selected")
    Run rlang::last_trace() to see the full context.
@elalbaicin
Copy link
Contributor Author

elalbaicin commented Feb 11, 2023

After a couple of tests, I've seen this runs yields an error:

adobe_analytics(date_range = c("2023-02-08", "2023-02-08"),
metrics = "productinstances",
dimensions = c("mobiledevicetype",
"evar4.3",
"lasttouchchannel",
"evar2.3",
"evar1.5",
"evar3.3"),
segmentId = "s1276_5fff77492b1c176b76b8aafc",
top = 10,
include_unspecified = TRUE)

But setting include_unspecified to FALSE works.

@benrwoodard
Copy link
Owner

That’s a great catch. What are the pretty names of the metrics and dimensions in the UI?

@elalbaicin
Copy link
Contributor Author

elalbaicin commented Feb 12, 2023

  1. Dimensions:
  • daterangeday = Day
  • mobiledevicetype = Mobile Device Type
  • lasttouchchannel = Last Touch Channel
  • product = Product
  • evar105.3 = Descripcion (Digital Campaings ID)
  • evar4.3 = Descripcion (Email Marketing (eid))
  • evar2.3 = Descripcion (External Campaings (sid))
  • evar1.5 = Descripcion (Internal Campaings (cid))
  • evar3.3 = Descripcion (Google Report Campaings (kid))
  1. Metrics:
  • productinstances = Product Views
  • revenue = Sales
  • event83 = Orders: Products Quantity (event83)

Those eVars called "Descripcion" seem the most likely to cause issues.

@elalbaicin
Copy link
Contributor Author

A colleague of mine found a way around by splitting extractions and joining the results later, but the issue has returned. This is the code:

aw_freeform_table(date_range = c("2023-02-18", "2023-02-18"), 
                               segmentId = "s1276_5fff77492b1c176b76b8aafc", 
                               metrics = "orders", 
                               dimensions = c("evar3", "evar3.3"),
                               top = 20)

evar3 stands for "Google Campaings Report (kid)" and evar3.3 stands for "Descripcion (Google Campaings Report (kid))".

And the error message:

Error in `pmap()`:
ℹ In index: 11.
Caused by error in `dplyr::rename()`:
! Can't rename columns that don't exist.
✖ Column `value` doesn't exist.

@benrwoodard
Copy link
Owner

Thanks again for your persistence in helping me solve this. Most errors I have come across are related to the API calls not returning data or expected data. Since I don't have access to your RSID I'll need to rely on you to help diagnose this issue and see if it is something we need to fix in the package or help by setting up a better error message. This may be a dumb question but, when you attempted to pull this report in the UI are you seeing orders with evar3 and the classification breakdown?

@elalbaicin
Copy link
Contributor Author

Yes, it does work in the UI. By the way, I've added evar3.3 back to the main query and dropped the intermediate query and the extraction worked. Go figure. At any rate, I'll try to run the underlying functions; if I find something out, I'll post it here.

@elalbaicin
Copy link
Contributor Author

elalbaicin commented Feb 22, 2023

This is the message I've got:

Caused by error in dplyr::rename() at get_req_data.R:119:2:
! Can't rename columns that don't exist.
✖ Column goosho_30924 doesn't exist.

First result saved in data (evar 3):

$totalPages
[1] 1

$firstPage
[1] TRUE

$lastPage
[1] TRUE

$numberOfElements
[1] 14

$number
[1] 0

$totalElements
[1] 14

$columns
$columns$dimension
$columns$dimension$id
[1] "variables/evar3"

$columns$dimension$type
[1] "string"

$columns$columnIds
[1] "orders::1"

$rows
itemId value data
1 0 Unspecified 100
2 3839476774 gooseabra_30367_vitrio 8
3 1346671738 goosho_30276 6
4 3507083343 goosho_30268 4
5 2103259066 gooseabra_30353_vitrio 3
6 313338677 gooseabra_30363_vitrio 3
7 2980804630 goosho_30267 2
8 2622463111 gooseabra_30371_vitrio 2
9 1514016642 goosho_30538_vitrio 2
10 331628775 gooseabra_30354_vitrio 2
11 3263322531 goosho_30924 1
12 2884973620 goosho_30272 1
13 2826432559 goosho_30271 1
14 1571982019 goosho_30574_vitrio 1

$summaryData
$summaryData$filteredTotals
[1] 136

$summaryData$totals
[1] 136

These are the results saved in data (index 11, with evar3.3). It strikes me that the rows element does not have a "value"column, unlike other results.

$totalPages
[1] 1

$firstPage
[1] TRUE

$lastPage
[1] TRUE

$numberOfElements
[1] 1

$number
[1] 0

$totalElements
[1] 1

$columns
$columns$dimension
$columns$dimension$id
[1] "variables/evar3.3"

$columns$dimension$type
[1] "string"

$columns$columnIds
[1] "orders::1"

$rows
itemId data
1 1377204712 1

$summaryData
$summaryData$filteredTotals
[1] 1

$summaryData$totals
[1] 1

Then, at line 67 of get_req_data.R, when trying to rename the column:

Error in dplyr::rename() at get_req_data.R:119:2:
! Can't rename columns that don't exist.
✖ Column goosho_30924 doesn't exist.
Run rlang::last_error() to see where the error occurred.

For comparison, this is the result of index 10, which does have a "value" column in rows:

$totalPages
[1] 1

$firstPage
[1] TRUE

$lastPage
[1] TRUE

$numberOfElements
[1] 1

$number
[1] 0

$totalElements
[1] 1

$columns
$columns$dimension
$columns$dimension$id
[1] "variables/evar3.3"

$columns$dimension$type
[1] "string"

$columns$columnIds
[1] "orders::1"

$rows
itemId value data
1 3129892729 vitrio-brand-institucional-search-sodimac-comprar-txt2 2

$summaryData
$summaryData$filteredTotals
[1] 2

$summaryData$totals
[1] 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants