Sorting

Hi I posted this message Dec 20th 2020 and did not receive any answers.

Hi, I have three questions
1: when using sortindex and column has dateformat in it it still sorts it as text, when using sortging by clicking on fixed column there I can set up grid.columns[aCol].SortFormat:=ssDate, but I can not find how to do it using sortindex
2: when filtering fd:=grid.addfilter ... when I want to filter by etc "waltz" it is working fine, but when it is two words like "ballroom waltz" then it does not find any rows
3: TMSFMXEditBtn.lookup when I enter what I want to see in Displaylist and values I want to save to ValueList, if it contains 2 rows it is working but when I enter more, it gives me random value from ValueList

I would like to add 2 more to my original topic
4: after I change order of rows by dragging some row up or down and exporting it to another grid or file, it exports in original order. How do I change that, so to keep new order?
5. I have 1 grid with about 2500 rows, representing music library, another grid is being filled by clicking on certain condition for example "Waltz". When "Waltz" is selected in my library I do sorting base on this condition and then only selected rows are copied to my second grid. When this is happening for the first time, it is within 1 second, but when I do selection for 2nd ... time it takes up to 10 sec, what can I do to have it in 1 sec?

We'll look into this as soon as possible.

  1. Which code are you using exactly? When using SortIndexes, it still looks at the Sortformat at column level. Can you provide more details?
  2. Did you include a wildcard and/or did you include double quotes?
  3. The DisplayList and ValueList need to contain the exact same number of items. Is this the case?
  4. Can you show me how you are exporting? Are you looping through the Cells?
  5. Please use BeginUpdate & EndUpdate
  1. After I added SortFormat when adding new sorting, it works fine, thank you.

  2. fd.Condition := 'Ballroom Waltz';

  3. Yes both have same amount of values. I take data from database and go row by row and put index to value list and value to value list.

  4. Yes I am looping through cells:
    sg_Q is grid I am moving to sg_newPL
    j is amount of rows in sg_Q
    with sg_Q do begin
    for I := 1 to j-1 do begin
    sg_newPL.Cells[0,i]:=sg_q.Cells[0,i]; //pc
    sg_newPL.Cells[1,i]:=sg_q.Cells[1,i]; //dance
    if e_myPL_What.Text='P' then begin
    sg_newPL.Cells[3,i]:=sg_q.Cells[2,i]; //Title
    sg_newPL.Cells[4,i]:=sg_q.Cells[3,i]; //MPM
    sg_newPL.Cells[5,i]:=sg_q.Cells[5,i]; //location
    //sg_newPL.Cells[6,i]:=sg_q.Cells[4,i]; //length
    end;
    end;

  5. Perfect that works great. Thank you.

  1. can you add double quotes so search?

  2. I'll investigate

  3. Can you use the AllCells property instead?

With search, double quotes works, thank you. What should I enter if I want to search parts of the string?
Equivalent to like ( where song_name like "head")

You need to add a wildcard *

I did try. I am getting results only if i write entire name. If I search for part string with * on the end or beginning I get no rows.
here is my code, in myCondition is my partial string for example 'ada*'
sg_library.RemoveFilters;
fd :=sg_library.Filter.Add;
fd.Column := 3;
fd.Condition := '"' + myCondition + '"';
fd.CaseSensitive:=false;
sg_library.ApplyFilter;

when I look in run time at condition I see,
myCondition 'ada*'
so it looks it left out "

Hi, Yes when looking for a condition with a space included, you need to use double-quotes, but if you want to search for a string that could match with another string, you need to use a wildcard. Combining wildcard and double quotes is not supported as it will effectively search for the string containing a wildcard instead. So if your condition is 'Ballroom Waltz' you need to use double-quotes. If your condition is 'Ballroom W*', you cannot use double-quotes