- Tue Apr 21, 2015 5:42 pm
#782798
Hi, Im trying to extract from a grid, in a specific field, the uniques values. In other words, make a distinct from a column. To later insert them into a listbox
In order to do this, I define a javascript function like this:
I need help to identify the error, or if you know any other way to do this.
Any help is welcome... Thanks...
Regards
In order to do this, I define a javascript function like this:
Code: Select all
Due the limitation of PM to debug, i havent found the error, i just know that the execution stops in the line:function ExtractUniqueValues()
{
//declare an empty array
var arraylistResponsables = new Array();
//count the grid rows
var filasGrid = Number_Rows_Grid("dgvActividades", "Responsable");
//loop the grid to check each row
for (var i = 1; i <= filasGrid ; i++)
{
//variable that contains the value of each cell in every loop
var elementoFila = getGridField("dgvActividades", i, "Responsable").value;
//loops the array to compare each value with the array item
//if it is empty, inserts it
if (parseInt(arraylistResponsables.length)==0)
{
arraylistResponsables[arraylistResponsables.length] = elementoFila;
}
else
{
for (var j= 0; j<= arraylistResponsables.length; j++)
{
//compare the values
if( elementoFila != arraylistResponsables[j] )
{
//if the value doesnt exist in the array, the value is added to the array
arraylistResponsables[arraylistResponsables.length] = elementoFila;
}
}
}
}
//loop the array to fill the listbox
for (var ind = 0; ind <= arraylistResponsables.length; ind++)
{
var objListaResponsable;
objListaResponsable = getField('lstResponsables');
opc = new Option(arraylistResponsables[ind] ,arraylistResponsables[ind] );
eval(objListaResponsable.options[objListaResponsable.options.length]=opc);
}
}
ExtractUniqueValues();
Code: Select all
else
{
for (var j= 0; j<= arraylistResponsables.length; j++)
{
I need help to identify the error, or if you know any other way to do this.
Any help is welcome... Thanks...
Regards