e: command setthedata in the data grid api

Trevor DeVore lists at mangomultimedia.com
Thu Apr 23 14:28:40 EDT 2009

On Apr 23, 2009, at 1:17 PM, Sadhu Nadesan wrote:

> Thank you for the explanation!  I am trying some variations on your  
> suggestion.  The code for the repeat loop that will do the deletion  
> is not within the behavior script for the data grid, so I cannot use  
> the syntax as suggested "of me", right?  The code is part of a menu  
> choice so it's in the menu button script.  I am trying to refer to  
> the data grid by it's name but do not have the syntax correct. I  
> can't find an example.  Details follow.

GetDataOfIndex is defined in the data grid itself (the behavior  
assigned to the data grid group to be exact) so calling GetDataOfIndex  
from a location that doesn't have the data grid in the message path  
won't work. In your example where you perform the loop outside of the  
data grid group itself you need to change the code a bit. You could  
possibly use 'call' but I think it is cleaner to use the dgDataOfIndex  
property instead.

repeat for each item theIndex in the dgIndexes of group "data grid 1"  
of card "data grid card"
     put the dgDataOfIndex[theIndex] of group "data grid 1" of card  
"data grid card" into theDataA
     if theDataA["col 2"] is not empty then

     end if
end repeat

However, what I would do if it were me is add the FilterMe command to  
the data grid group script and then trigger it from the menu button  

send "FilterMe" to group "DataGrid 1"


Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com

More information about the use-livecode mailing list