Welcome to the LimeSurvey Community Forum

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

Matriz de números

  • brodriguez
  • brodriguez's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200153 by brodriguez
Matriz de números was created by brodriguez
Hola, tengo una pregunta sobre matriz de número donde tengo en las columnas marcas y en las filas atributos. Mi pregunta es cómo hacer que las marcas roten, o sea se muestren en orden aleatorio

Gracias!
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200157 by holch
Replied by holch on topic Matriz de números
This is the English forum, please only use English here.
Este es el foro en Ingles, por favor, solo usar Ingles. Voy a mover la pregunta al foro en Español.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200158 by holch
Replied by holch on topic Matriz de números
Qual es tu versión de LS?

Hasta 3.x estoy bastante seguro que no funciona, por lo menos no "out of the box" (sin una solución individual en JavaScript).

Ahora 4.x (que yo actualmente no recomiendo porque todavía tiene muchos errores) hay un bug, que la función "rotar" hace rotar tanto las lineas cuanto las columnas. Entonces parece que 4.x puede ter esta función (pero no recomiendo usarlo por causa de todos los bugs en abierto).

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • brodriguez
  • brodriguez's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200160 by brodriguez
Replied by brodriguez on topic Matriz de números
Hola es Versión 3.17.13+190824

Sería ideal poder contar entonces con una solución en javascript, (se pega el script en el texto de la pregunta - modo de código fuente)

Gracias
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200167 by holch
Replied by holch on topic Matriz de números
Con Javascript no puedo ayudar.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • brodriguez
  • brodriguez's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200168 by brodriguez
Replied by brodriguez on topic Matriz de números
Gracias y ojalá alguien mas pudiera ayudarme...


Saludos
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200189 by Joffm
Replied by Joffm on topic Matriz de números

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brodriguez
  • brodriguez's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200191 by brodriguez
Replied by brodriguez on topic Matriz de números
Efectivamente Joffm
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200223 by Joffm
Replied by Joffm on topic Matriz de números
Un ejemplo.

File Attachment:

File Name: limesurvey...3343.lss
File Size:24 KB




Nota: Solo se cambia el texto en las columnas.
Debe reestructurar antes del análisis debido al orden en "Def".

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brodriguez
  • brodriguez's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #200255 by brodriguez
Replied by brodriguez on topic Matriz de números
Muchas gracias :)

Hay alguna forma cuando las etiquetas o nombres de las marcas son muy largas, poder ubicarlas en forma vertical?
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #200848 by Joffm
Replied by Joffm on topic Matriz de números
Una solución mejor

En el codigo fuente de la pregunta.
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:scriptcomplete',function(){
    randomArrayNumCols({QID});
    });
 
  // A function to randomize columns in an array-numbers question
  function randomArrayNumCols(qID){
 
    var thisQuestion = $('#question'+qID);
 
    // Index the array columns
    $('table.subquestion-list tr', thisQuestion).each(function(i) {
      $('> *', this).each(function(i) {
        $(this).attr('data-index', i);
      });
    });
 
    // Create an array of the columns
    var columns = [];
    $('table.subquestion-list tr[id^="javatbd"]:eq(0) td.answer-item', thisQuestion).each(function(i) {
      columns.push($(this).attr('data-index'));
    });
 
    // Shuffle the columns array
    columns = $.shuffle(columns);
 
    // Reposition the row elements
    $('table.subquestion-list tr', thisQuestion).each(function(i) {
      var thisRow = $(this);
      $(columns).each(function(i, val) {
        thisRow.append($('[data-index="'+val+'"]', thisRow));
        thisRow.append($('.col-no-answer', thisRow));
      });
    });
  }
 
  // A function to shuffle elements or contents of arrays
  (function($){
    $.fn.shuffle = function() {
      return this.each(function(){
        var items = $(this).children();
        return (items.length)
          ? $(this).html($.shuffle(items))
          : this;
      });
    }
 
    $.shuffle = function(arr) {
      for(
        var j, x, i = arr.length; i;
        j = parseInt(Math.random() * i),
        x = arr[--i], arr[i] = arr[j], arr[j] = x
      );
      return arr;
 
    }
  })(jQuery);
</script>

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brodriguez
  • brodriguez's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #200849 by brodriguez
Replied by brodriguez on topic Matriz de números
Muchas gracias Joffm :)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose