Search in Data Grid Form
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Search in Data Grid Form
Hello,
I'd like to do a search in a data grid form but exclude the hilite state of checkboxes.
Here are the steps:
put the dgText of grp "DataGrid 1" into tData
then
filter tData with ("*" & tSearchString & "*")
but in the tData there will be "true" or "false" for the hilite state of checkboxes.
If I want to search the text lines for words like true or false etc. then the lines that have the checkbox hilites as true or false will also be found and displayed.
How can I eliminate in a simplest way the checkbox hilites values from the filter?
Attached is the stack as an example.
Thanks in advance.
keram
I'd like to do a search in a data grid form but exclude the hilite state of checkboxes.
Here are the steps:
put the dgText of grp "DataGrid 1" into tData
then
filter tData with ("*" & tSearchString & "*")
but in the tData there will be "true" or "false" for the hilite state of checkboxes.
If I want to search the text lines for words like true or false etc. then the lines that have the checkbox hilites as true or false will also be found and displayed.
How can I eliminate in a simplest way the checkbox hilites values from the filter?
Attached is the stack as an example.
Thanks in advance.
keram
- Attachments
-
- DG Form search.zip
- (17.44 KiB) Downloaded 208 times
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: Search in Data Grid Form
Hi keram,
OK, first use the FILTER WITH command for a rough check.
Then you will need to loop through all lines and all items of the lines that you want to check.
Means leave out the column(s) with the hilite values.
Know what I mean?
No quick way
Best
Klaus
OK, first use the FILTER WITH command for a rough check.
Then you will need to loop through all lines and all items of the lines that you want to check.
Means leave out the column(s) with the hilite values.
Know what I mean?
No quick way

Best
Klaus
Re: Search in Data Grid Form
Thanks Klaus,
If I understood correctly this would be the solution:
this is what I added:
filter tData with ("*" & tSearchString & "*")
repeat for each line i in tData
filter item 3 of i with ("*" & tSearchString & "*") -- I want to search only in item 3 of each line
end repeat
but still when I search for false or true, the search is not ignoring the columns with hilite values.
keram
If I understood correctly this would be the solution:
Code: Select all
on mouseUp
local tSearchString,Counter = "0", DataArray
set itemDel to tab
ask "Search for what word or string of words?" with "tellus" titled "Search"
if it = empty then exit to top
put it into tSearchString
put the dgText of grp "DataGrid 1" into tData
filter tData with ("*" & tSearchString & "*")
repeat for each line i in tData
filter item 3 of i with ("*" & tSearchString & "*") -- I want to search only in item 3 of each line
end repeat
if tData = empty then
answer "No matching data!"
exit to top
end if
lock screen
repeat for each line i in tData
add 1 to Counter
put item 4 of i into DataArray[Counter]["Num"] --line 1 number of dgform
put item 1 of i into DataArray[Counter]["BtnCheck"] --line 1 checkbox of dgform
put item 2 of i into DataArray[Counter]["Cat"] --line 1 cat of dgform
put item 3 of i into DataArray[Counter]["Label"] --line 1 label of dgform
end repeat
set the dgData of grp "DataGrid 1" to DataArray --populate dgform
set the dgVScroll of grp "DataGrid 1" to "0" --top
send "RefreshList" to grp "DataGrid 1"
end mouseUp
filter tData with ("*" & tSearchString & "*")
repeat for each line i in tData
filter item 3 of i with ("*" & tSearchString & "*") -- I want to search only in item 3 of each line
end repeat
but still when I search for false or true, the search is not ignoring the columns with hilite values.
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: Search in Data Grid Form
Hi Keram,
you cannot filter ITEMS in a line unfortunately!
I was thinking of something like this:
Best
Klaus
you cannot filter ITEMS in a line unfortunately!
I was thinking of something like this:
Code: Select all
on mouseUp
local tSearchString,Counter = "0", DataArray
set itemDel to tab
ask "Search for what word or string of words?" with "tellus" titled "Search"
if it = empty then
exit to top
end if
put it into tSearchString
put the dgText of grp "DataGrid 1" into tData
filter tData with ("*" & tSearchString & "*")
## No need to continue if the rough check already fails!
if tData = empty then
answer "No matching data!"
exit to top
end if
repeat for each line i in tData
if item 3 of i contains tSearchString then
put i & CR after tNewData
end if
end repeat
delete char -1 of tNewData
## Nothing found
if tNewData = empty then
answer "No matching data!"
exit to top
end if
## Since your datagrid ia obviously a TABLE you can simply:
set the dgTEXT of grp "DataGrid 1" to tNewData --populate dgform
set the dgVScroll of grp "DataGrid 1" to "0" --top
send "RefreshList" to grp "DataGrid 1"
end mouseUp
Klaus
Re: Search in Data Grid Form
Hi Klaus,
It works OK now.
This is a dg FORM so the last few lines I have to keep as they were before:
lock screen
repeat for each line i in tNewData
add 1 to Counter
put item 4 of i into DataArray[Counter]["Num"] --line 1 number of dgform
put item 1 of i into DataArray[Counter]["BtnCheck"] --line 1 checkbox of dgform
put item 2 of i into DataArray[Counter]["Cat"] --line 1 cat of dgform
put item 3 of i into DataArray[Counter]["Label"] --line 1 label of dgform
end repeat
set the dgData of grp "DataGrid 1" to DataArray --populate dgform
Thanks again
keram
It works OK now.
This is a dg FORM so the last few lines I have to keep as they were before:
lock screen
repeat for each line i in tNewData
add 1 to Counter
put item 4 of i into DataArray[Counter]["Num"] --line 1 number of dgform
put item 1 of i into DataArray[Counter]["BtnCheck"] --line 1 checkbox of dgform
put item 2 of i into DataArray[Counter]["Cat"] --line 1 cat of dgform
put item 3 of i into DataArray[Counter]["Label"] --line 1 label of dgform
end repeat
set the dgData of grp "DataGrid 1" to DataArray --populate dgform
Thanks again

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: Search in Data Grid Form
Hi Keram,
...
put the dgText of grp "DataGrid 1" into tData
filter tData with ("*" & tSearchString & "*")
...
Best
Klaus
ah, OK, I guessed TABLE from your first lines:keram wrote:This is a dg FORM
...
put the dgText of grp "DataGrid 1" into tData
filter tData with ("*" & tSearchString & "*")
...

Best
Klaus