How to Add New Variables to Questions used by Complicated Filters

From Q
Jump to: navigation, search

When a filter that has been created using Insert Variable(s) > Binary - Complicated Filter, this will prevent changes to the question(s) on which the filter depends. This includes preventing the use of Set Question, but not other changes like editing the Values of the question. The reason is that the filter relies on the structure of the existing question. It is sometimes necessary to add new variables to a question like this, for example when new brands are added to a tracking study. One option is to make a new copy of the question using Copy and Paste Questions: Exact Copy and add the new variables to the copy. In some cases, this can be impractical.

Here we describe a method that can be used to work around this problem. The method involves dragging variables and tables between two copies of the same project. The method will not work if any of the constructed variables are marked as Invalid, so these variables should be fixed before you begin.

Firstly, create a placeholder variable to keep track of your constructed variables. To do so:

  1. Go to the Variables and Questions tab.
  2. Right-click and select Insert Variable(s) > JavaScript Formula > Numeric.
  3. Change the Label to PLACEHOLDER.
  4. Click Ok.

You can easily locate this variable by typing placeholder in the Find box. It will be used to keep track of the constructed variables as you move them between projects.

Now, assume that the question which has new variables is called Q1. If there are multiple questions with new variables, then depending on the complexity of your project, you may wish to apply the following to each question one at a time. It is important to save new copies of your work as you go, as this method involves deleting variables, and you may wish to back-track if you make a mistake.

  1. In the Variables and Questions tab, use the ToBottom.png button to move PLACEHOLDER to the bottom of the list.
  2. Highlight the rows from the current version of Q1.
  3. Right-click the question and choose Trace Dependencies > Used By. This highlights all of the variables in your project that depend on Q1.
  4. Use the ToBottom.png button to move these variables to the bottom.
  5. Highlight all of the variables below PLACEHOLDER.
  6. Right-click them and choose Trace Dependencies: Used By.
  7. Use the ToBottom.png button to move these variables to the bottom.
  8. Repeat steps 5-7 until no dependent variables remain above PLACEHOLDER.
  9. Save a new copy of your project (i.e. with a different file name).
  10. Open a second copy of the project that you just saved in a new Q window. Place the two windows side-by-side.
  11. In the main copy, highlight all variables below PLACEHOLDER.
  12. Right-click them and select Delete Copied or Constructed Variables.
  13. Make the necessary changes to Q1, i.e. using Set Question.
  14. Drag the variables below PLACEHOLDER from the second copy of the project to the first copy.

Now, the correct variables should be in the main copy of your project, and the question Q1 should contain the new variables. The process of deleting constructed variables will break any tables that depend on these variables. To remedy this, you should drag copies of these tables from the second copy of your project. It may be quicker to drag the entire report tree. Make sure to inspect the changes that you have made to ensure that they are correct. Make sure to save a new copy of your project.