Find in a DataGrid

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Find in a DataGrid

Post by lohill » Thu Oct 18, 2012 5:34 pm

The following quote describes the different forms of the Find command that works for fields on a card:
The six forms of the find command search in different ways. The find normal, find chars, and find words forms search for each word in the textToFind, but the words don't have to be together to be found; they only have to all appear on the same card. The find words and find wholeforms look for complete words only. The find string and find whole forms search for the textToFind as a unit.
This actually works for the fields in a DataGrid but in such s 'random' way as to be useless. There are datagrid commands FindIndex and FindLine that will find the date in a particular column if there is an exact match. Is there any way to find the index or line in the datagrid when you want other than an exact match?

Larry

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Find in a DataGrid

Post by lohill » Sat Oct 20, 2012 4:56 pm

Well, it is not pretty but it works and I am always surprised at how quickly LiveCode can do it. I am using a brute force method by putting the dgText of the DataGrid into a variable and then looping through all the lines looking at the offset of the characters I want to find. I use global variables for the search argument and the last line found so that 'next' searches can continue where the last left off. My DataGrid has almost 2500 rows and searches take almost no time.

Larry

Post Reply