Data Grid API - FindIndex pKey, pSearchString
Posted: Tue Dec 01, 2009 12:29 pm
Hello All,
I was hoping to use FindIndex as a stepping stone to implementing multi-column filtering functionality for my Data Grid.
I was hoping to filter the contents of a single column of my Data Grid like so:
I had considered that pSearchString would be passed the values the user types in the column specific filter (field), and that like in the above example if a user typed Mi* my code would look in Col 2 of my Data Grid and return an array of Data Grid indexes that matched the wildcard search.
Two problems arise:
1. FindIndex appears only to look for a single (perhaps first) match,
2. Wild cards like * do not seem to work. "Mi*" results in index 0 (no match), whereas "Mitchell" results in index 4 (Line 4, Column 2 of the DataGrid contains the name Mitchell).
I do know how to filter the grid (based on the content of all columns) using:
, that is not the issue. I need be able to filter the data using criteria (with wildcards) for each column against the content of each column. As FindIndex supports multiple pkey and pSearchString, it seemed the likely solution until I hit the issues raised above. For instance a direct match like does work on a single matching row, returning its id, being 4, so perhaps there is a way forward and I merely have the syntax wrong.
Building multi-column filtering is important to me, as I am analysing large datasets (1 million +) records with my DataGrids.
Perhaps I have the wrong approach to the multi-column filter challenge?
Any assistance greatly appreciated.
Kind regards, Andrew
PS: calling/channeling Trevor Devore?
I was hoping to use FindIndex as a stepping stone to implementing multi-column filtering functionality for my Data Grid.
I was hoping to filter the contents of a single column of my Data Grid like so:
Code: Select all
dispatch "FindIndex" to group "DataGrid 1" with "Col 2", "Mi*"
put the result into tIndexes
repeat for each item tIndex in tIndexes
answer info tIndex -- for testing only, will contain code to update the display of the Data Grid based on an array of matching indexes
end repeat
Two problems arise:
1. FindIndex appears only to look for a single (perhaps first) match,
2. Wild cards like * do not seem to work. "Mi*" results in index 0 (no match), whereas "Mitchell" results in index 4 (Line 4, Column 2 of the DataGrid contains the name Mitchell).
I do know how to filter the grid (based on the content of all columns) using:
Code: Select all
put the dgText of grp "DataGrid 1" into tText
put fld "fldFilterFirstName" into tFilter
filter tText with ("*" & tFilter & "*")
set the dgText of grp "DataGrid 1" to tText
Code: Select all
dispatch "FindIndex" to group "DataGrid 1" with "Col 2", "Mitchell", "Col 3", "Melbourne"
Building multi-column filtering is important to me, as I am analysing large datasets (1 million +) records with my DataGrids.
Perhaps I have the wrong approach to the multi-column filter challenge?
Any assistance greatly appreciated.
Kind regards, Andrew
PS: calling/channeling Trevor Devore?