Move, mirror, clone

Create multiple views of the same data

Updated at August 9th, 2022

Drag + drop elements in Protobi to change the order of questions or create different views of the same question. 

When your drag + drop a dialog with three options pops up:

  • Move - Puts the element in a new spot.
  • Mirror (copy by reference) - References the same element in multiple spots. Edits to the element in one spot will apply to it everywhere.
  • Clone (independent copy) - Creates an independent element. Edits to the clone do not apply to the original element.

Drag + drop elements within the main panel

In the main panel we can drag S1 between two charts to move it. The yellow line marks the new spot.

When you drag an element make sure you select the blue rectangular pill with the question's displayKey (i.e. S1).

Drag + drop elements within the tree

You can also drag elements within the tree to move them.

If you drag an element onto a group instead of specifying a position, it will place the element last in that group. 

Drag + drop elements from the tree into the main panel

You can also drag from the tree into the main panel. 

Drag + drop elements from the main panel to the tree

Protobi recently enabled moving elements from the main panel to the tree.

Mirror vs clone

The key difference is that mirror copies are the same element referenced in multiples spots and clones are independent elements that point to the same data column.

Mirror

Mirroring an element just means you're showing the same chart in more than one spot. Mirror copies have the same key, if you edit the element in one place it will change it everywhere.

Delete a mirror copy

Because they share a key, you cannot hide or delete a mirror copy without affecting the original element and vice versa. You can remove an element from a group's list of children and that will delete it from one group without removing it from any other groups where it's referenced.

Clone

Cloning allows you to create an independent copy of an element. Cloning is useful when you want to see a question in a different chart type or create a banner element from a question without changing the original chart.

You can drag + drop to create a clone, or select the element, press the "Advanced" button in the toolbar and choose "Clone".

Protobi prompts you to give the new element a new key. The key cannot be identical to any other key in the project. 

When Protobi creates an initial element for each data column, its key is the same as the data column name. When you create a mirror view the references share a same key, but when you create a clone it has a different key than the original element. 

Because this new element has its own unique key, we can change its properties without affecting the original element. In addition to a different key, the new element will have an attribute field with a value that refers to the data column from the original element. You can verify this by selecting "More properties..." from the context menu.

Delete a clone

You can remove clones from view by hiding or deleting them as you would any other element. Since clones have unique keys, removing them won't have an affect on original elements. Select the clone, then press the del key on your keyboard. 

Clone to create a different type of chart

Let's say your survey has a data column "state." By default, Protobi shows each data column as an interactive bar chart. The element state will initially appear like this:


There are many ways you can modify this element. You might want to see the data in a different chart type, language, or as recoded values. By cloning, we can create these different visualizations without changing the original element. 

In this example we've cloned state and entered "state_cloud" for the new element's key.

You now have two different elements pointing at the same data column:


You can change the new element without affecting the first. Press the blue edit icon, and from the context menu choose "Chart type..." and select "Word cloud." 

Cloning groups: simple vs recursive

In the above example, we cloned a simple element state that had no children. It's also possible to create multiple views of an entire group. 

When you clone a group you can clone just the parent group (simple clone) or recursively copy its child elements (recursive clone). 

Simple

If we create a simple clone, both parent groups will refer to the same children by reference. If we change the titles or formats for a child element in one group, it will change it in both. Typically, a simple clone is sufficient when creating a different visualization of a compacted group.  

We have a group q15 that shows ratings as a stacked bar chart:

We clone (simple) the element to see it as a tornado chart as well:


Recursive

This will not only clone the parent, but also create independent copies of all the children. Changes to both the parent and children in this type of clone will be independent from the original group. 

Rather than specify a new key for the clone element, for recursive clones you specify a prefix that will be prepended to each element's key to generate new keys.

Set heritability on cloned groups

Some changes parent elements propagate down to its children. This includes changing color, format, recodes, filters and crosstab columns. You may want to modify the group without those changes propagating down to the child elements. 

In simple clones, both parent groups refer to the same children. If you want to set a specific format or filter on the cloned parent but you don't want the children to reflect these changes under the original group, turn heritability off.

To do this press the edit icon, select "More properties..." and set "Heritable" to "No."

Video tutorial





Was this article helpful?