Is there a way to find particular lines in a datagrid and collect them in an array? I know I can do this with a repeat loop from an array, but have not been able to do so with a datagrid (or is it just advisable to always take the datagrid to an array first?).
So for example if I have a datagrid of music terms with columns "Term" and "Definition", and I need lines 1, 20, and 300.... how would I structure the repeat loop and an array to put them into? Anything I have tried will just get the first needed line at best.
Selectively retrieving rows from a datagrid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 379
- Joined: Thu Dec 08, 2011 2:43 am
-
- Posts: 379
- Joined: Thu Dec 08, 2011 2:43 am
Re: Selectively retrieving rows from a datagrid
One of my many failed attempts today:
Code: Select all
on makeTheTerms2
if the visible of group id 160621 of card id 1002 is false then
put the dgHilitedLines of group "DataGrid 2" into line.number
if line.number < 1 then
answer "Please choose a line first"
exit makeTheTerms2
end if
dispatch function "GetDataOfLine" to group "DataGrid 2" with line.number, "Terms" --the terminology definitions I need
put the result into theLinesToCheck
replace comma with tab in theLinesToCheck--so I can treat them as words
put 1 into whichLine
repeat for each word thisWord in theLinesToCheck
call GetDataOfLine(thisWord) of group id 159323 of card id 1009
put the result into line whichLine of theNeededTerms
add 1 to whichLine
end repeat
set the dgData of group id 160621 of card id 1002 to theNeededTerms
show group id 160621 of card id 1002
dispatch "RefreshList" to group id 160621 of card id 1002
exit makeTheTerms2
end if
if the visible of group id 160621 of card id 1002 is true then hide group id 160621 of card id 1002
end makeTheTerms2
Re: Selectively retrieving rows from a datagrid
Try either of: the dgDataOfIndex or the dgDataOfLine.
The most intuitive is the dgDataOfLine[tLine], so that dgDataOfLine[3] would return the third line.
Read here:
http://lessons.runrev.com/s/lessons/m/d ... or-Column-
Craig Newman
The most intuitive is the dgDataOfLine[tLine], so that dgDataOfLine[3] would return the third line.
Read here:
http://lessons.runrev.com/s/lessons/m/d ... or-Column-
Craig Newman
-
- Posts: 379
- Joined: Thu Dec 08, 2011 2:43 am
Re: Selectively retrieving rows from a datagrid
annnnd, boom just like that, dgDataOfLine. Thanks Craig, I read through all of the API stuff but I wasn't seeing it clearly was I.
Thanks again, and Happy New Year.
Brian
Thanks again, and Happy New Year.
Brian