Searching a Datagrid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 7
- Joined: Mon Jan 13, 2014 6:57 pm
Searching a Datagrid
Hello LiveCode pimps!!!
I have an issue that I am trying to figure out a solution to...and I require your assistance if you would be so kind.
I have 2 datagrids. One datagrid contains all of my saved data, the second is going to be to display searched data from the first one. My question is, how in the heck do I go about doing that?
The datagrid with all of my information is going to be on a "hidden" card and the display datagrid will be on a public "reporting" card.
my question is how do I search for a specific string on the first datagrid, and have it display the entire line that string is on and all instances of that string.
Any help would be much appreciated.
Thanks!
I have an issue that I am trying to figure out a solution to...and I require your assistance if you would be so kind.
I have 2 datagrids. One datagrid contains all of my saved data, the second is going to be to display searched data from the first one. My question is, how in the heck do I go about doing that?
The datagrid with all of my information is going to be on a "hidden" card and the display datagrid will be on a public "reporting" card.
my question is how do I search for a specific string on the first datagrid, and have it display the entire line that string is on and all instances of that string.
Any help would be much appreciated.
Thanks!
Re: Searching a Datagrid
HI altamative131,
if your datagrid is of type TABLE, you could do something like this:
You get the picture
Best
Klaus
if your datagrid is of type TABLE, you could do something like this:
Code: Select all
...
put "whatever" into tSearchString
## Now put all data into a variable:
put the dgtext of grp "the hidden one with all your data in it" of cd "a card with a hidden datagrid" into tData
## Now use FILTER to get all lines with the searchstring in them:
filter tData with ("*" & tSearchString & "*")
if tData = empty then
answer "No matching data!"
exit to top
end if
## Finally put found data into other datagrid
set the dgdata of grp "data display" to tData
...

Best
Klaus
Re: Searching a Datagrid
Pimps?
Craig
Craig
Re: Searching a Datagrid
Yep, that's me!dunbarx wrote:Pimps?
Craig

Re: Searching a Datagrid
Nice Klaus.Klaus wrote:HI altamative131,
if your datagrid is of type TABLE, you could do something like this:You get the pictureCode: Select all
... put "whatever" into tSearchString ## Now put all data into a variable: put the dgtext of grp "the hidden one with all your data in it" of cd "a card with a hidden datagrid" into tData ## Now use FILTER to get all lines with the searchstring in them: filter tData with ("*" & tSearchString & "*") if tData = empty then answer "No matching data!" exit to top end if ## Finally put found data into other datagrid set the dgdata of grp "data display" to tData ...
![]()
Best
Klaus
Many thanks.
Last edited by LC4iOS on Fri Jan 24, 2014 10:37 pm, edited 1 time in total.
Thanks to RunRev.
Thanks to LiveCode forum members.
LiveCode v5.5.5 - iOS Android Mac Windows - 6.5 Community
27" 2012 iMac i5, MacBook Pro, MacBook Air, iPhone 5, iPhone 4
xCode 5.0.2 - iOS7 - OS X Mavericks
Paid Apple iOS Developer Program Member
Thanks to LiveCode forum members.
LiveCode v5.5.5 - iOS Android Mac Windows - 6.5 Community
27" 2012 iMac i5, MacBook Pro, MacBook Air, iPhone 5, iPhone 4
xCode 5.0.2 - iOS7 - OS X Mavericks
Paid Apple iOS Developer Program Member
Re: Searching a Datagrid
Klaus, with a K!LC4iOS wrote:Nice Claus.

Don't mess with a PIMP!

Re: Searching a Datagrid
Hi Klaus with K,
Nice photo of you...
or maybe photo on this page
http://newsletters.livecode.com/october ... etter3.php
is better ... is it you?
keram

Is this working only for dg Tables or for dg Forms as well?Klaus wrote:if your datagrid is of type TABLE, you could do something like this:
Nice photo of you...

or maybe photo on this page
http://newsletters.livecode.com/october ... etter3.php
is better ... is it you?
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
-
- Posts: 34
- Joined: Mon Feb 24, 2014 10:12 am
Re: Searching a Datagrid
altamative131,
this work for me.
i am using a datagrid and a database to show the exact value is been search put this code in you button to search
it only work if you have a database.
best
blaireTabay
this work for me.
i am using a datagrid and a database to show the exact value is been search put this code in you button to search
it only work if you have a database.
Code: Select all
local Ldisplay
local Tdisplay, sea
put field "txt_keywords" into search
put "select id, lastName,givenName,middleName,age,sex from hos_tblpatientinfo where lastName LIKE '%" & search & "%'" into tabay
put revdatafromQuery(,,connID,tabay)into Tdisplay
set the dgText of group "dgGrid" to tDisplay
blaireTabay
Re: Searching a Datagrid
Hi Blaire,
yes, this is how one searches a database, but the original poster had been asking for something else!
Best
Klaus
yes, this is how one searches a database, but the original poster had been asking for something else!

Best
Klaus