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

Error get ticket function #1

Closed
nschaefer1211 opened this issue Aug 6, 2021 · 8 comments
Closed

Error get ticket function #1

nschaefer1211 opened this issue Aug 6, 2021 · 8 comments

Comments

@nschaefer1211
Copy link

nschaefer1211 commented Aug 6, 2021

Hi,

when running the following command:

zdeskR::get_tickets(email_id, token, subdomain,
start_time = "2021-07-31 00:00:00", end_time = "2021-08-01 23:59:59")

I got the following error: Error: Can't combine ..1$30196289 <character> and ..142$30196289 <logical>.
The rlang::last_error() backtrace gave the following:

Backtrace:

  1. zdeskR::get_tickets(...)
  2. purrr::map_dfr(seq_len(nrow(tickets)), pivot_data_frame)
  3. dplyr::bind_rows(res, .id = .id)
  4. vctrs::vec_rbind(!!!dots, .names_to = .id)
  5. vctrs::vec_default_ptype2(...)
  6. vctrs::stop_incompatible_type(...)
  7. vctrs:::stop_incompatible(...)
  8. vctrs:::stop_vctrs(...)

Does anybody know what the issue here is?

@chrisumphlett
Copy link
Owner

Possible something to do with custom fields, those values look like field id's.

The general error of "can't combine [type a] and [type b]" is because when purrr::map_dfr is looping over all the results and combining them into a single data frame, there is a column (30196289 I think) which in one df is a character and the other a logical type. The logical probably because it's all NA and R couldn't detect the actual type so it gets logical by default.

Do you have the access and knowledge to look into your zendesk configuration and find out if 30196289 is a field id, and what that field is?

@nschaefer1211
Copy link
Author

nschaefer1211 commented Aug 6, 2021

Thank you so much for your prompt reply!
I think you are on the right track. I checked, 30196289 is a field id. It is a checkbox whether to send an email or not. So the value should always either be TRUE or FALSE. Does that help?

@chrisumphlett
Copy link
Owner

Here is what I think is happening
image

Unfortunately I think I can diagnose the problem well but I don't know how to solve it. Converting every custom field column to character would probably solve the problem but might cause other undesirable issues (slow things down and lead to non-character columns being character and force the user to convert it back).

Maybe only converting logical columns to character would be better? But even then, that could result in an error if the column was truly numeric.

I have another function that you're likely going to want to use called get_custom_fields(). This is useful to make sense of the data from get_tickets() if there are a lot of custom fields. Perhaps there would be some way to use the custom field data and optionally interject it into the get_tickets() process. EG, you could select all of the custom field Ids that you want to keep and specify the data type. That would be slick, but I don't have time to work on that right now.

I think my preference in the short term to help solve your problem would be to allow the user to drop undesired columns. Without more users of the package to pitch in about how they use it and what is better long-term, I can only speculate. What do you think of that? There would be a new function input, you'd put "30196289" there. Then run it again. If another column fails, you'd have to add that as well.

If you don't like that you could fork the package and do the conversion of everything to character but I wouldn't want to merge that back in, at least not yet. I would not like it for our data.

@nschaefer1211
Copy link
Author

I think you hit the nail on the head with your analysis of the situation. I also don't know how to fix this problem easily. However, your short-term fix with allowing the user to drop undesired columns should work for me. This drop argument should allow for multiple columns to be selected, if possible, as I have another checkbox.
Thank you so much for taking the time and effort to find a solution!!

@chrisumphlett
Copy link
Owner

I pushed a change to a new branch for you to try out. I have tested and it works for me, see sample code below.

tix2 <- get_tickets(email_id = email_id, token = token, subdomain = subdomain, start_time = "2021-08-11", end_time = "2021-08-11", remove_cols = c("23798518", "55790847"))

You can install this from GH like this: remotes::install_github("chrisumphlett/zdeskR@remove-cols-from-tickets").

@nschaefer1211
Copy link
Author

It worked, thank you so much!! I will close this issue soon but while I have your attention, I was wondering if it would be possible to also include arguments start_time and end_time in the get_all_ticket_metrics()-function. That would be of great help to me.

@chrisumphlett
Copy link
Owner

Great. I made a new issue for your latter comment, see response there.

I am going to leave this open a bit longer and test it on my end with our code that gets ticket data daily and make sure there are no problems there. Then I'll merge it in with the master and it can be installed as the regular dev version. I won't push that to CRAN right now.

@nschaefer1211
Copy link
Author

Sounds great, thanks again!

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