Problems with selecting lines in DataGrid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Problems with selecting lines in DataGrid
Hi all,
I have a simple question regarding the selection of some lines in my DataGrid.
Here is an example of my DataGrid:
Company Company_Code
DHL 10
UPS 20
Express 27
Now I have a text string with "10,27"
Is it possible to identify the company_code(s) in my DataGrid with the text string and select the complete line?
Thank you, Moritz
I have a simple question regarding the selection of some lines in my DataGrid.
Here is an example of my DataGrid:
Company Company_Code
DHL 10
UPS 20
Express 27
Now I have a text string with "10,27"
Is it possible to identify the company_code(s) in my DataGrid with the text string and select the complete line?
Thank you, Moritz
-
- VIP Livecode Opensource Backer
- Posts: 9665
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Problems with selecting lines in DataGrid
Hi.
I always extract the full suite of DG information with "DGText", process in the "clear", and then restore.
The tools available in LC proper are far more accessible and powerful than any native DG functionality. The extra two steps of extracting and restoring are trivial.
Once you have the line(s) of interest while processing back in LC, you simply select them in the DG after restoring.
Craig Newman
EDIT.
Are you OK with that "processing in the clear"? In other words, dataGrids notwithstanding, can you do what you need to with finding the lines of interest?
I always extract the full suite of DG information with "DGText", process in the "clear", and then restore.
The tools available in LC proper are far more accessible and powerful than any native DG functionality. The extra two steps of extracting and restoring are trivial.
Once you have the line(s) of interest while processing back in LC, you simply select them in the DG after restoring.
Craig Newman
EDIT.
Are you OK with that "processing in the clear"? In other words, dataGrids notwithstanding, can you do what you need to with finding the lines of interest?
Re: Problems with selecting lines in DataGrid
Hi.
I already started to put the Data Grid into a clear but I have still problems with it:
any idea what is going on wrong?
I already started to put the Data Grid into a clear but I have still problems with it:
Code: Select all
## Put the Data Grid into DG_List
put the dgText of group "dg_zahlungsart_ausblenden" into DG_list
## Delemiter
set the itemdelimiter to tab
## start checking if content from string zahlungsart_auslassen3 exist in Data Grid
repeat for each item tItem4 in zahlungsarten_auslassen3
repeat for each line tLine1 in DG_list
## put the items into variables
put item 2 of tLine1 into Vergleich_WI
put tItem4 into Vergleich_ZA
## compare the variables
if Vergleich_WI = Vergleich_ZA
then
## hilite the selected lines (does not work)
put the dghilitedlines of group "dg_zahlungsart_ausblenden" into zeile
answer zeile
else
end if
end repeat
end repeat
Re: Problems with selecting lines in DataGrid
Hallo Moritz,
so sollte es klappen:
Please read my comments in the script.
Datagrids are the most complex beasts in LC, but also the most attractive controls,
which is very dangerous for newbies.
BTW, we also have a german LC forum:
http://www.livecode-blog.de/forums/foru ... ode-forum/
Gruß/Best
Klaus
leider eine ganze Menge...
so sollte es klappen:
Code: Select all
...
## Put the Data Grid into DG_List
put the dgText of group "dg_zahlungsart_ausblenden" into DG_list
## Delemiter
set the itemdelimiter to tab
## zahlungsarten_auslassen3 is defined as GLOBAL or LOCAL variable?
## so the content of zahlungsarten_auslassen3 = TAB delimited list of numbers, right?
## We will work here with ITEMOFFSET, so we need to:
set the wholematches to TRUE
## Simply beacause 1 is also in 11, but we want a "whole match" :-)
## We use "repeat for each", so we need to manage our own COUNTER
put 0 into tCounter
## We collect the numbers of the lines that need to be be hilited:
put empty into tLinesToBeHilited
# repeat for each item tItem4 in zahlungsarten_auslassen3
repeat for each line tLine1 in DG_list
add 1 to tCounter
if itemoffset(item 2 of tLine,zahlungsarten_auslassen3) <> 0 then
## we need to collect all the lines adn then HILITE them all together afterwards
put tCounter & "," after tLinesToBeHilited
end if
end repeat
## Delete trailing COMMA in tLinesToBeHilited
delete char -1 of tLinesToBeHilited
## NOW we hilite all found lines "en bloc"
if tLinesToBeHilited <> EMPTY then
set the dgHilitedLines of grp "dg_zahlungsart_ausblenden" to tLinesToBeHilited
end if
...
Datagrids are the most complex beasts in LC, but also the most attractive controls,
which is very dangerous for newbies.
BTW, we also have a german LC forum:
http://www.livecode-blog.de/forums/foru ... ode-forum/
Gruß/Best
Klaus
Re: Problems with selecting lines in DataGrid
Hallo Klaus,
Vielen dank für deine schnelle Antwort. Es funktioniert genau wie es soll. Habe mich auch gleich mal in dem Deutschen Live Code Forum angemeldet.
Wünsche noch einen schönen Tag.
Vielen dank für deine schnelle Antwort. Es funktioniert genau wie es soll. Habe mich auch gleich mal in dem Deutschen Live Code Forum angemeldet.
Wünsche noch einen schönen Tag.
Re: Problems with selecting lines in DataGrid
Great you got it working!