Zu Hauptinhalten wechseln

FV Decipher Unterstützung

Alle Themen, Ressourcen für FV Decipher benötigt.

 
decipher

Data Aggregation

VirtualQuestions function by calculating a single answer based on the actual respondent data from other questions. Aggregate questions work by taking the finished data for the other questions as displayed in the report and then performing calculations on them.

1:  Technical Details

To create an aggregate question, enter the formula inside an aggregate tag, similar to the virtual tag: the formula is Python code that runs to determine what the question's data displayed in the report should be.

2:  Limitations

Currently only all-rows RadioTag, CheckboxTag, and respective VirtualQuestions can be the input and output questions for aggregates. This can be expanded as the need arised.

In the aggregate formula, specify e.g. q1.r1 to get the number of users that answered q1 as r1, q1.shown for the number of users shown that question and q1.answered for the number of users that answered that question.

To actually assign the values, assign to the this object. For example, the stack aggregate function for 3 questions could be implement in this way:

<radio title="Aggregate">
  <row label="r1">I like it</row>
  <row label="r2">I don't like it</row>
  <row label="r3">I hate it</row>

<aggregate>
this.r1 = q3.r1 + q4.r1 + q5.r1
this.r2 = q3.r2 + q4.r2 + q5.r2
this.r3 = q3.r3 + q4.r3 + q5.r3
this.shown = q3.shown + q4.shown + q5.shown
this.answered = q3.answered + q4.answered + q5.answered
</aggregate>

</radio>

We set the count for the r1 to be equal to the sum of the r1 rows in q3, q4, q5. Similarly, the shown/answered counts are set to the sum of those 3 questions.

The aggregate attribute is not supported for secure surveys.

3:  Built-in aggregates

Following built-in aggregates are available:

3.1:  stack

Given a list of questions which must have the same rows as this aggregate question, make this question essentialy be equal to the sum of the other questions row and answered counts. E.g. aggregate='stack(q3,q4,q5)' will make each row in this question be sum of each of the corresponding rows in the 3 questions.

You can force another base for the question by specifying the rebase argument. E.g. stack(q3,q4,q5, rebase=q0). In such a case, the shown/answered totals will be retrieved from q0.

3.2:  stagger

 
given a list of questions, the staggered question will copy the result of the Nth question in the Nth segment. Basically this can be used to (rather awkwardly!) generate a 2D table in the report. In the below example, q6xx will display q6a data in segment 1, q6b in segment 2 etc. The filters on the segments are irrelevant (and in fact, should be the same).
<radio label="q6xx" title="q6* aggregated" grouping="rows"> <aggregate>stagger(q6a,q6b,q6c,q6d,q6e,q6f,q6g)</aggregate> @fit @top2group1d </radio> 

3.3:  staggerRows, staggerCols

Copies columns or rows of a function into segments local to this function, enabling a 2D view of a question, e.g.:
<radio label='q1' title='Rate these items'>
 <col label='c1' value='5' groups='g1'>I feel like I know a lot about them</col>
 <col label='c2' value='4' groups='g1'>I feel like I know a bit about them</col>
 <col label='c3' value='3' groups='g2'>I don't feel I know much about them</col>
 <col label='c4' value='2' groups='g3'>I've only heard the name</col>
 <col label='c5' value='1' groups='g3'>I've never heard of them</col>

 <row label='r1'>Item 1</row>
 <row label='r2'>Item 2</row>
 <row label='r3'>Item 3</row>
</radio>

If we want to see this as a single table, rather than 3 separate ones, we can do:

<radio label='a1' averages='cols' aggregate='staggerRows2(q1)' title='Aggregated'>
 <col label='c1' value='5' groups='g1'>I feel like I know a lot about them</col>
 <col label='c2' value='4' groups='g1'>I feel like I know a bit about them</col>
 <col label='c3' value='3' groups='g2'>I don't feel I know much about them</col>
 <col label='c4' value='2' groups='g3'>I've only heard the name</col>
 <col label='c5' value='1' groups='g3'>I've never heard of them</col>
</radio>

So the columns are unchanged but the rows become segments that are valid for just this one question only.

3.4:  staggerColsWithTotal

staggerColsWithTotalis similar to staggerCols, but also adds a Total segment at the beginning. This is useful when enabling horizontalPercentages="1" on the question. staggerColsWithTotal aggregate function accepts the argument across=1 which sums up the totals of all segments to generate the Total-Total.

Example:

aggregate="staggerColsWithTotal(questionLabel,across=1)"

aka: Data Stacking

  • War dieser Artikel hilfreich?