Sugeshan247
MIS
Hi Guys,
I have made progress in attempting to sort the TStringAlignGrid using multiple columns. I am able to hold down ctrl key and capture that column name into a tStringList. The string values from these columns are concatenated/copied into a "Sort" column and then i want to sort on that column. However i am seperating each value from each column with a ',' and padding them with 5 zero's. When the code to sort the grid run's, the sorting is inaccurate.
I thought i would post only the part where the copying and concatenating of the values are taking place. The values are transfered to a "Sort" column. The sort code is then executed but the results of the sorting are inaccurate.
for index := 0 to sColumnList.Count - 1 do
begin
sColumn := sColumnList.Strings[index];
for c := 0 to sag.ColCount - 1 do
begin
if sColumn = sag.Cells[c,0] then
begin
for r := 2 to sag.RowCount - 1 do
begin
sag.Cells[SortCol, r] := sag.Cells[SortCol, r] + '00000';
sValue := sag.Cells[c, r] + ',';
sag.Cells[SortCol, r] := sag.Cells[SortCol, r] + sValue;
end;
end;
end;
end;
sag.SortColumn(SortCol, bAscending);
When i copy these values (from the sort column) into excel, it sorts correctly.
Has anyone done a sort on more than 1 column in a TStringAlignGrid before? Pls help.
I have made progress in attempting to sort the TStringAlignGrid using multiple columns. I am able to hold down ctrl key and capture that column name into a tStringList. The string values from these columns are concatenated/copied into a "Sort" column and then i want to sort on that column. However i am seperating each value from each column with a ',' and padding them with 5 zero's. When the code to sort the grid run's, the sorting is inaccurate.
I thought i would post only the part where the copying and concatenating of the values are taking place. The values are transfered to a "Sort" column. The sort code is then executed but the results of the sorting are inaccurate.
for index := 0 to sColumnList.Count - 1 do
begin
sColumn := sColumnList.Strings[index];
for c := 0 to sag.ColCount - 1 do
begin
if sColumn = sag.Cells[c,0] then
begin
for r := 2 to sag.RowCount - 1 do
begin
sag.Cells[SortCol, r] := sag.Cells[SortCol, r] + '00000';
sValue := sag.Cells[c, r] + ',';
sag.Cells[SortCol, r] := sag.Cells[SortCol, r] + sValue;
end;
end;
end;
end;
sag.SortColumn(SortCol, bAscending);
When i copy these values (from the sort column) into excel, it sorts correctly.
Has anyone done a sort on more than 1 column in a TStringAlignGrid before? Pls help.