Skip to content

Error on duplicate 'Data Export Tags' #10

Description

@warnes

I have inherited a Qualtrics survey that contains some Data Export Tags that are shared between current and previously used questions (some were present twice, one was present three times):

> survey <- jsonlite::read_json(qsfFile)
> tags <- survey$SurveyElements |> lapply(\(x) x$Payload$DataExportTag) |> unlist()
> table(tags)  |> as.data.frame() |> filter(Freq > 1)
   tags Freq
1  Q101    2
2  Q103    2
3  Q105    2
4  Q107    3
5  Q109    2
6  Q111    2
7  Q114    2
8  Q116    2
9  Q126    2
10 Q128    2
11 Q130    2
12 Q132    2

I used the following code to make the Data Export Tags unique:

survey <- jsonlite::read_json(qsfFile)
tags <- survey$SurveyElements |> lapply(\(x) x$Payload$DataExportTag) |> unlist()
uniqueTags <- tags |> make.unique(sep="-")
j <- 1
j_max <- length(survey$SurveyElements)
for(i in 1:length(tags))
{
  while (survey$SurveyElements[[j]]$Element != 'SQ' && j < j_max) j <- j+1
  survey$SurveyElements[[j]]$Payload$DataExportTag <- uniqueTags[i]
  j <- j+1
}

And then wrote the data back out to a 'qsf' json file.

Now, when I load the revised 'qsf' file, only a single variant of the original tags is shown (e.g. "Q103-1" "Q126-1" "Q128-1"), which I will now need to rename to strip off the '-1'.

This is a straighforward task for me, but may not be for others.

I suggest implementing something similar inside of QualtricsTools. If this succeeds in resolving the problem, the user should be notified (i.e. via warning()) of the duplicates instead of generating an error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions