Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Is there a replacement field for Number of Groups?

  • f1refly
  • f1refly's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago #142330 by f1refly
I have setup my survey to process Group By Group. When the process bar is shown, it seems to be showing a percentage based on the number of groups not the number of questions. That's OK but it has been confusing some of the people in my test group...

I would like to modify the statement on the Welcome page that states "There are X questions in this survey" to something like "There are X questions shown on X pages". I have the statement changed but haven't found a way to put in the value for the number of groups/pages. Is there a way?

Thanks for all your help.
The topic has been locked.
More
7 years 6 months ago #142331 by jelo
Not that I know.
You can count the groups after finalizing the survey and you're done.
But why do you think that will make an impact?
Do you have groups with that many questions?
The irritation is mostly in combination with hidden questions/groups.
So a calculation based on shown questions or the position would help.

I'm still trying to convince the developers to provide a calculation routine based on
a) Questions shown or b) Question position in the survey
Feel free to add your support to the feature request:
bugs.limesurvey.org/view.php?id=9677

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: f1refly
The topic has been locked.
  • f1refly
  • f1refly's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago #142333 by f1refly
[quote="jelo" post=142331
But why do you think that will make an impact?
Do you have groups with that many questions?
[/quote]

No, it's probably the opposite. With 10 questions total and only 3 or 4 groups, it's easy for the participants to calculate the % based on the number of questions. After the first group with 1 question and the % is stated as 20% complete, they go "Huh???" :laugh:

I'm not real worried about it but 3 or 4 of my 10 test users brought it up.

I could hardcode the number of groups into the template but then I'd have to use a different template for each survey and I plan a sequence of 5 or 6 surveys so I don't want to go there.

A calculation based on the number of visible questions would be great but of course, the system might not know the number of visible questions at the beginning if you are making run-time decisions about hiding them.

Thanks for the input.
The topic has been locked.
More
7 years 6 months ago #142334 by jelo

f1refly wrote: A calculation based on the number of visible questions would be great but of course, the system might not know the number of visible questions at the beginning if you are making run-time decisions about hiding them.

My featurerequest is more about a way to ensure that the indication of progress is correct.
E.g. if you want to do looping in LimeSurvey, you'll end up copying everything. Many workarounds are about copying a lot of questions but only showing a fraction of it to the respondent.
Displaying the total amount of hundreds of questions on the first page would drive non-response sky high.

I have added a feature request for a variable which contains the number of questions groups.
Let's see if there is a way to access it today. Perhaps via Javascript.
bugs.limesurvey.org/view.php?id=11716

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 6 months ago #142346 by tpartner
You can manually set the progress value with a little JavaScript in the group description.

What LimeSurvey version are you using?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
7 years 6 months ago #142347 by jelo

tpartner wrote: You can manually set the progress value with a little JavaScript in the group description.
What LimeSurvey version are you using?

I'm looking for a solution under LS 2.5. There seems to be no live manipulation of the progress-bar possible.
My workaround for LS 2.06 is in the feature request bugs.limesurvey.org/view.php?id=9677
Any idea for LS 2.5? I'm still no using it in a productive way.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 6 months ago #142348 by tpartner

I'm looking for a solution under LS 2.5...

Try something like this in the group description.

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function() {
    // Progress bar value
    var progressValue = 50;
    $('.progress-bar').css('width', progressValue+'%').text(progressValue+'%'); 
    });  
</script>

If you plan to use it often, you could place a function like this in template.js:
Code:
function customProgressValue(progressValue) {
  $(document).ready(function() {
    $('.progress-bar').css('width', progressValue+'%').text(progressValue+'%'); 
  });  
}

And then call it from the group description or a question source like this:
Code:
<script type="text/javascript" charset="utf-8">    
  customProgressValue(65);
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: LouisGac
The topic has been locked.
More
7 years 5 months ago #142424 by jelo

tpartner wrote:

I'm looking for a solution under LS 2.5...

Try something like this in the group description.
[code type=javascript]<script type="text/javascript" charset="utf-8">
$(document).ready(function() {


Thanks for the example. Is it really for LS 2.5X.?
I have tried this on the demo.limesurvey.org installation (Version 2.51.4 ).
On the first question group the indication stands at 0% with the js-code in the group description.
Perhaps a demo limit.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 5 months ago #142467 by tpartner

Thanks for the example. Is it really for LS 2.5X.?

Try the attached survey. There is a script in the first (only) group description to push the progress bar to 65%. It works for me in 2.52 (latest GIT pull) with the default template.

File Attachment:

File Name: limesurvey...-2-3.lss
File Size:14 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: f1refly
The topic has been locked.
  • f1refly
  • f1refly's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #142635 by f1refly
I'm using 2.53. Thanks!
The topic has been locked.
More
7 years 5 months ago #142647 by jelo

f1refly wrote: I'm using 2.53. Thanks!

Did it worked on your installation?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 5 months ago - 7 years 5 months ago #142664 by LouisGac
For future references, here the lines of code to generate the progress bar:

PERCENTCOMPLETE replacement keyword is defined in replacement helper:
github.com/LimeSurvey/LimeSurvey/blob/ma...ents_helper.php#L686
Code:
$coreReplacements['PERCENTCOMPLETE'] = isset($percentcomplete) ? $percentcomplete : '';    // global

$percentcomplete is defined in survey runtime helper:
github.com/LimeSurvey/LimeSurvey/blob/ma...lper.php#L1087-L1097
Code:
if ($surveyMode != 'survey' &amp;&amp; isset($thissurvey['showprogress']) &amp;&amp; $thissurvey['showprogress'] == 'Y')
{
 if ($show_empty_group)
 {
  $percentcomplete = makegraph($_SESSION[$LEMsessid]['totalsteps'] + 1, $_SESSION[$LEMsessid]['totalsteps']);
 }
 else
 {
  $percentcomplete = makegraph($_SESSION[$LEMsessid]['step'], $_SESSION[$LEMsessid]['totalsteps']);
 }

function makegraph is defined in frontend helper:
github.com/LimeSurvey/LimeSurvey/blob/ma...helper.php#L157-L174
Code:
function makegraph($currentstep, $total)
{
 global $thissurvey;
 Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'lime-progress.css');
 $size = intval(($currentstep-1)/$total*100);
 $graph='htmlstuff...';
 return $graph;
}

And finally, $_SESSION[$LEMsessid] is defined in frontend helper too:
github.com/LimeSurvey/LimeSurvey/blob/ma...lper.php#L1673-L1689
Code:
function setTotalSteps($surveyid, array $thissurvey, $totalquestions)
{
  switch($thissurvey['format'])
  {
    case "A":
    $_SESSION['survey_'.$surveyid]['totalsteps']=1;
    break;
 
    case "G":
    if (isset($_SESSION['survey_'.$surveyid]['grouplist']))
    {
    $_SESSION['survey_'.$surveyid]['totalsteps']=count($_SESSION['survey_'.$surveyid]['grouplist']);
    }
    break;
 
    case "S":
    $_SESSION['survey_'.$surveyid]['totalsteps']=$totalquestions;
  }
}

You can see in this last snippet that the total steps in format group by group is defined on the base of the number of groups.
Last edit: 7 years 5 months ago by LouisGac.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose