+1 vote

Hello, community!

I'm using the new .erase feature and found an odd behaviour. Maybe it's me.

The scenario is that I'm asking a checklist question with the option to answer "Others". If the user selects that, it opens a *multiple type of answer for the user to add his other options.

Thus, I'd like to have 3 collections:

  • One with the original selection (including "others")
  • One with what the user added in the *multiple question
  • One consolidated collection, but without the "others" element in it.

Thus, what I tried, is to create a new collection based on the original one. Erasing the "others" element and adding the "others" collection. Here's an example:

*question: Which letter do you like?
*type: checkbox
*save: results_original

*if: "Others" in results_original
	*question: Which other letters do you like?
		*save: results_other
Original *before* erase from full: {results_original}

>>results_full = results_original

Original *after* erase from full: {results_original}
Other: {results_other}
Full: {results_full}

However, what I found is that the results_original collection also don't have the "others" element in it. Here's a sample result.

Original before erase from full: A, B, Others

Original after erase from full: A, B, X, Y
Other: X, Y
Full: A, B, X, Y

I find this odd, because I'm applying the .erase to the results_full collection, but it seems to be changing the results_original as well.

Perhaps the = assignation doesn't create a new list with just the values, but assigns another name to the same list?
Any help or insights here would be greatly appreciated!

by (320 points)

1 Answer

+1 vote
Best answer

Do this instead:

>>resultsFull = [] 

You can find the full explanation for it in the manual:

by (2.5k points)
selected by

It worked perfectly, thanks!

Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
121 questions
131 answers
69 users