- Posts: 116
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random5== 1, 'KMT',if(random5== 2, 'DPP',if(random5== 3, 'NPP',if(random5== 4, 'TPP','NA'))))}</span></span></strong></span></td> <td bgcolor="#f2f2f2" style="text-align: center;"><p><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random7== 1, 'lower high school',if(random7== 2, 'high school',if(random7== 3, 'Under Graduate','Graduate')))}</span></span></strong></span></p>
Please Log in to join the conversation.
{if(random5== 1, 'KMT',if(random5== 2, 'DPP',if(random5== 3, 'NPP',if(random5== 4, 'TPP','NA'))))} {if(is_empty(random6),if(random5==2,rand(3, 4), rand(1,4)),random6)}
{if(is_empty(random6),if(random5==2,rand(1, 3, 4), rand(1,4)),random6),if(is_empty(random6),if(random5==1,rand(2, 3, 4), rand(1,4)),random6), }
Please Log in to join the conversation.
<tr> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">黨籍</span></span></strong></span></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random5== 1, 'KMT',if(random5== 2, 'DPP',if(random5== 3, 'NPP',if(random5== 4, 'TPP','NA'))))}</span></span></strong></span></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random6== 1, 'KMT',if(random6== 2, 'DPP',if(random6== 3, 'NPP',if(random6== 4, 'TPP','NA'))))}</span></span></strong></span></td> </tr> <tr style="height: 6px; text-align: center;"> </tr> <tr> <td bgcolor="#f2f2f2" style="text-align: center;"> <p><span style="font-size:20px;"><strong><span style="color:#000000;"> <font face="標楷體">學歷</font></span></strong></span></p> <p><span style="font-size:20px;"><strong><span style="color:#000000;"><font face="標楷體">前一份工作</font></span></strong></span></p> </td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"> <p><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random7== 1, 'lower high school',if(random7== 2, 'high school',if(random7== 3, 'Under Graduate','Graduate')))}</span></span></strong></span></p> </td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random8== 1, 'lower high school',if(random8== 2, 'high school',if(random8== 3, 'Under Graduate','Graduate')))}</span></span></strong></span></td> </tr>
{if(is_empty(random7),if(random5==2,rand(3, 4), rand(1,4)),random7)}
It is only:
If "random5" is equal 2 (DPP) then "random7" is a random number from 3-4, so 1(Lower high school) and 2(high school) will not be selected.
If "random5" is not equal 2 then "random7" is a random number from 1-4, so all degrees are possible.
Of course everything surrounded by the usual construct "if(!is_empty(randonnumber), "
I think this was your requirement.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
That's the already shown code (if the second column is random6)and if in the first column there is DPP then in the second column there is only NPP and TPP?
Now, please, decide about your naming.for random6, can I use the word to replace the number?
random6 "1 = lower high school/ 2 = high school/ 3 = Undergraduate/ 4 = Graduate"
If I have two condition:
1. random 5 is equal 2 (DPP), random6 will appear 1 or3 or 4,
2. random 5 is equal 1 (KMT), random6 will appear 2 to 4,
Please Log in to join the conversation.
{if(is_empty(random6),if(random5==2,round(1.3*rand(1,3)), rand(1,4)),random6)}
rand(1,3) selects a random number 1, 2 or 3
so the result of 1.3*rand(1,3) is 1.3, 2.6 or 3.9
And after rounding you have your desired 1,3 and 4
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.