Datagrid: How get column data from other column behavior

Andre.Bisseret Andre.Bisseret at inria.fr
Fri Apr 9 10:46:06 EDT 2010


Bonjour,

Assuming I have a datagrid "cellar" with

Appellation / Price
Bourgogne / 43
Bordeaux / 38
Aubance / 25

I want to change the price of one wine

1 - the user has to select a line then

put the dgHilitedLines of grp "Cellar" into tLine
put the dgDataOfLine[tLine] of grp "Cellar" into theDataA
ask "What's the price?" with theDataA["Price"]
put it into theDataA["Price"]
set the dgDataOfLine[tLine] of group "Cellar" to theDataA

OK works well

2 - Now I would like to be able to change a price but starting from a  
given wine' name, not from the selection of a its line (not really  
needed currently, but for learning more about datagrid ;-))

I found the following; for example I have to change the price of the  
Aubance:

put the dgData of grp "cellar" into theDataA
repeat for each key theIndex in theDataA
if theDataA[theIndex]["Appellation"] is "Aubance" then
Ask "What's the new price for Aubance?"
  put it into theDataA[theIndex]["Price"]
end if
set the dgData of grp "cellar" to theDataA
end repeat

That works but seems not particularly straighforward (the loop only to  
find the right one ;-)))

Am sure there is a far better way but I don't find it
Any idea much appreciated

Best regards from Grenoble

André


Le 8 avr. 10 à 15:24, Trevor DeVore a écrit :

> On Apr 6, 2010, at 5:07 PM, JosepM wrote:
>
>> I need to customize one column behavior in function of the data of  
>> other
>> column.
>> How can get the value of the other column from the script of the  
>> behavior
>> for the column?
>>
>> Any idea?
>
> Use GetDataOfIndex().
>
> Data Grid API: <http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7344-Data-Grid-API 
> >
>
> Examples:
>
> How Can I Colorize Individual Lines in a Table?: <http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7332-How-Can-I-Colorize-Individual-Lines-in-a-Table- 
> >
>
> How Do I Get Data Associated With a Row or Column?: <http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7313-How-Do-I-Get-Data-Associated-With-a-Row-or-Column- 
> >
>
> -- 
> Trevor DeVore
> Blue Mango Learning Systems
> ScreenSteps: http://www.screensteps.com
> Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution






More information about the use-livecode mailing list