Expression manager - using self in assessment

More
4 years 8 months ago #87350 by de_chris
de_chris created the topic: Expression manager - using self in assessment
Hi, I'm trying to generate something like a report at the end of my survey. Therefore I have some questions:
1. If I want to be more flexible I have to define my own functions in PHP or Java Script. Therefore I would have to write my own function to the template or directly to the Expression Manager php-files. If I extend the Expression Manager would this break the update compatibility?

2. More important to my is the question if I can iterate over all question using the self variable? In my case I have about 50 questions. To check for occurence of single answers results in a very large expression. For example I used this expression in an older survey to check the proportion of the answers:

{if(sum(A1.value==3,A2.value==3,A3.value==3,A4.value==3,A5.value==3, B1.value==3,B2.value==3,B3.value==3,B4.value==3,B5.value==3,B6.value==3, C1.value==3,C2.value==3,C3.value==3, D1.value==3,D2.value==3,D3.value==3,D4_1.value==3,D4_2.value==3,D4_3_1.value==3,D4_3_2.value==3,D4_3_3.value==3,D4_4_1.value==3,D4_4_2.value==3,D4_4_3.value==3,D5_1.value==3,D6.value==3,D7.value==3,D8.value==3,D9.value==3,D10.value==3,D11.value==3,D12.value==3,D13.value==3,D14.value==3,D15.value==3, E1.value==3,E2.value==3,E3.value==3)==
sum(A1.value==2,A2.value==2,A3.value==2,A4.value==2,A5.value==2, B1.value==2,B2.value==2,B3.value==2,B4.value==2,B5.value==2,B6.value==2, C1.value==2,C2.value==2,C3.value==2, D1.value==2,D2.value==2,D3.value==2,D4_1.value==2,D4_2.value==2,D4_3_1.value==2,D4_3_2.value==2,D4_3_3.value==2,D4_4_1.value==2,D4_4_2.value==2,D4_4_3.value==2,D5_1.value==2,D6.value==2,D7.value==2,D8.value==2,D9.value==2,D10.value==2,D11.value==2,D12.value==2,D13.value==2,D14.value==2,D15.value==2, E1.value==2,E2.value==2,E3.value==2)
,"<div>equal</div>",
if(sum(A1.value==3,A2.value==3,A3.value==3,A4.value==3,A5.value==3, B1.value==3,B2.value==3,B3.value==3,B4.value==3,B5.value==3,B6.value==3, C1.value==3,C2.value==3,C3.value==3, D1.value==3,D2.value==3,D3.value==3,D4_1.value==3,D4_2.value==3,D4_3_1.value==3,D4_3_2.value==3,D4_3_3.value==3,D4_4_1.value==3,D4_4_2.value==3,D4_4_3.value==3,D5_1.value==3,D6.value==3,D7.value==3,D8.value==3,D9.value==3,D10.value==3,D11.value==3,D12.value==3,D13.value==3,D14.value==3,D15.value==3, E1.value==3,E2.value==3,E3.value==3)>
sum(A1.value==2,A2.value==2,A3.value==2,A4.value==2,A5.value==2, B1.value==2,B2.value==2,B3.value==2,B4.value==2,B5.value==2,B6.value==2, C1.value==2,C2.value==2,C3.value==2, D1.value==2,D2.value==2,D3.value==2,D4_1.value==2,D4_2.value==2,D4_3_1.value==2,D4_3_2.value==2,D4_3_3.value==2,D4_4_1.value==2,D4_4_2.value==2,D4_4_3.value==2,D5_1.value==2,D6.value==2,D7.value==2,D8.value==2,D9.value==2,D10.value==2,D11.value==2,D12.value==2,D13.value==2,D14.value==2,D15.value==2, E1.value==2,E2.value==2,E3.value==2),
"<div><b>OK</b></div>",
"<div><b>bad</b></div>"
))}

or for occurence:
{if(sum(A1.value==1,A2.value==1,A3.value==1,A4.value==1,A5.value==1, B1.value==1,B2.value==1,B3.value==1,B4.value==1,B5.value==1,B6.value==1, C1.value==1,C2.value==1,C3.value==1, D1.value==1,D2.value==1,D3.value==1,D4_1.value==1,D4_2.value==1,D4_3_1.value==1,D4_3_2.value==1,D4_3_3.value==1,D4_4_1.value==1,D4_4_2.value==1,D4_4_3.value==1,D5_1.value==1,D6.value==1,D7.value==1,D8.value==1,D9.value==1,D10.value==1,D11.value==1,D12.value==1,D13.value==1,D14.value==1,D15.value==1, E1.value==1,E2.value==1,E3.value==1)>0,"<div>You answered dog on at least one answer</div>","")}
3. If I write my own Java Script function in the template how can I access the questions (e.g. E3.value)?
thanks in advance

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now