(data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?
Mike Bonner
bonnmike at gmail.com
Wed Aug 18 20:31:41 EDT 2010
It goes in a custom behavior script for the column you want the sum to
appear in.
To do a quicky test, create a stack, add a grid, in the inspector
create columns Sum, Col 2 and Col 3
While on the columns screen in the inspector, at the bottom click the
plus to add a custom behavior. It will open up a template for that
column, click the now enabled behavior button and change the fillNData
section to contain
put the dgIndex of me into theIndex
set the text of field 1 of me to (GetDataOfIndex(theIndex, "Col 2") +
GetDataOfIndex(theIndex, "Col 3"))
instead of the line to set it to pData
save the script, save the stack, close the template editor.
Shove some data in for col 2 and col 3, and when it hits the Sum col
during fill should do the calculation and fill the data in.
On Wed, Aug 18, 2010 at 5:48 PM, Josh Mellicker <josh at dvcreators.net> wrote:
>
> On Aug 18, 2010, at 6:21 AM, Trevor DeVore wrote:
>
>> On Aug 17, 2010, at 10:52 PM, Mike Bonner wrote:
>>
>>> If you set a custom behavior for the column you want the sum in, and
>>> where it has the section for filling data, put
>>>
>>> put the dgDataOfIndex[ the dgIndex of me] of the dgControl of me
>>> into theDataA
>>> set the text of field 1 of me to (theDataA["Col 2"] + theDataA["Col 3"])
>>>
>>> Should work fine. Not positive this is the best method, but seems to
>>> work dandy fine with small datasets. Haven't tried it with big ugly
>>> datasets.
>>
>> If you didn't want to fetch all of the data for the entire row you could use GetDataOfIndex. GetDataOfIndex only retrieves the value of a specific column.
>>
>> put the dgIndex of me into theIndex
>> set the text of field 1 of me to (GetDataOfIndex(theIndex, "Col 2") + GetDataOfIndex(theIndex, "Col 3"))
>
>
> And this code goes into FillInData in the table's behavior, right?
>
>
>>
>> --
>> 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
>
> _______________________________________________
> 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