Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-19 Thread zryip theSlug
On Thu, Aug 19, 2010 at 1:48 AM, Josh Mellicker j...@dvcreators.net 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?

You have two options:
- change the script in the column behavior for the column you want to
display a sum.
- or define a default column behavior for the datagrid


If you choose the first option, change your script with a code like this:

on FillInData pData
   local tTheIndex

   put the dgIndex of me into tTheIndex
   put sumOfColumn(tTheIndex,Col2,Col3) into pData
   set the text of the long id of me to pData

end FillInData

function sumOfColumn pTheIndex
   local tTheSum

   put 0 into tTheSum

   repeat with x = 2 to the paramcount
  add GetDataOfIndex(pTheIndex,param(x)) to tTheSum
   end repeat

   return tTheSum
end sumOfColumn


If you prefer the second solution, you're welcome to download and use
the code of the sample stack I proposed in my first reply ;)

Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-19 Thread Josh Mellicker
Wow, I just looked at this, fabulous!!! Thanks!!!

On Aug 18, 2010, at 1:19 PM, zryip theSlug wrote:

 On Wed, Aug 18, 2010 at 4:15 AM, Josh Mellicker j...@dvcreators.net wrote:
 Let's say you had a data grid table with three columns, and you wanted the 
 first column to be the sum of the other two, like this:
 
 10  7   3
 5   2   3
 7   4   3
 
 How would you calculate the first column while the table is filling in?
 
 
 ---
 
 Originally, we looped through the data and did the calculations, then put 
 the data into the data grid. Now the data set is getting so large that this 
 is too slow, looping through once to calc, then again for the grid. So we're 
 thinking doing the calculation in FillInData would be more efficient. If 
 possible.
 
 It's easy to find any field value in a Data Grid form, since pData is an 
 array with the row values, but we'd like to avoid switching to a 
 form.___
 
 I have just upload an experiment stack in the Slug's website:
 http://www.aslugontheroad.co.cc/index.php?option=com_phocadownloadview=categorydownload=8:experiment-013-doing-sum-in-a-column-of-a-data-gridid=7:data-gridItemid=63
 
 The experiment shows how doing a sum of three columns in a column of a
 data grid:
 - when the dg is filling in
 - when you change a value in one of the three columns.
 
 The stack using a custom column behavior. You can access to the script
 by clicking on the edit script button.
 
 HTH
 
 Regards,
 -- 
 -Zryip TheSlug- wish you the best! 8)
 http://www.aslugontheroad.co.cc
 ___
 use-revolution mailing list
 use-revolution@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-18 Thread Trevor DeVore

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))


--
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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-18 Thread Bob Sneidar
Also, if the displayed values is all you care about, then can't you only do 
calculations for the displayed data as opposed to the entire dataset? Obviously 
this will not work if you want to extract the entire data set and work with it 
later. 

Bob


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))
 
 -- 
 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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


(data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-18 Thread Peter Haworth
Not sure what the source of your data is but if it's coming from a  
database, maybe you could have the db do the calculation for you when  
it retrieves the data.  I'm using sqlite and have found it to be  
lightning fast at calculations while retrieving data, so maybe  
something like SELECT columnA + columnB as Total, columnA, columnB  
FROM ,tablename


Pete Haworth

On Aug 18, 2010, at 9:25 AM, use-revolution-requ...@lists.runrev.com  
wrote:



Message: 12
Date: Tue, 17 Aug 2010 19:15:40 -0700
From: Josh Mellicker j...@dvcreators.net
Subject: (data grid) is there a good workaround for obtaining other
column  values in FillInData for a Data Grid Table?
To: how to use Revolution use-revolution@lists.runrev.com
Message-ID: 9aaa4c70-8786-42d2-a901-f117d956c...@dvcreators.net
Content-Type: text/plain; charset=us-ascii

Let's say you had a data grid table with three columns, and you  
wanted the first column to be the sum of the other two, like this:


10  7   3
5   2   3
7   4   3

How would you calculate the first column while the table is filling  
in?


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-18 Thread zryip theSlug
On Wed, Aug 18, 2010 at 4:15 AM, Josh Mellicker j...@dvcreators.net wrote:
 Let's say you had a data grid table with three columns, and you wanted the 
 first column to be the sum of the other two, like this:

 10      7       3
 5       2       3
 7       4       3

 How would you calculate the first column while the table is filling in?


 ---

 Originally, we looped through the data and did the calculations, then put the 
 data into the data grid. Now the data set is getting so large that this is 
 too slow, looping through once to calc, then again for the grid. So we're 
 thinking doing the calculation in FillInData would be more efficient. If 
 possible.

 It's easy to find any field value in a Data Grid form, since pData is an 
 array with the row values, but we'd like to avoid switching to a 
 form.___

I have just upload an experiment stack in the Slug's website:
http://www.aslugontheroad.co.cc/index.php?option=com_phocadownloadview=categorydownload=8:experiment-013-doing-sum-in-a-column-of-a-data-gridid=7:data-gridItemid=63

The experiment shows how doing a sum of three columns in a column of a
data grid:
- when the dg is filling in
- when you change a value in one of the three columns.

The stack using a custom column behavior. You can access to the script
by clicking on the edit script button.

HTH

Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-18 Thread Josh Mellicker

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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-18 Thread Mike Bonner
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 j...@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


(data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-17 Thread Josh Mellicker
Let's say you had a data grid table with three columns, and you wanted the 
first column to be the sum of the other two, like this:

10  7   3
5   2   3
7   4   3

How would you calculate the first column while the table is filling in?


---

Originally, we looped through the data and did the calculations, then put the 
data into the data grid. Now the data set is getting so large that this is too 
slow, looping through once to calc, then again for the grid. So we're thinking 
doing the calculation in FillInData would be more efficient. If possible.

It's easy to find any field value in a Data Grid form, since pData is an array 
with the row values, but we'd like to avoid switching to a 
form.___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: (data grid) is there a good workaround for obtaining other column values in FillInData for a Data Grid Table?

2010-08-17 Thread Mike Bonner
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.

On Tue, Aug 17, 2010 at 8:15 PM, Josh Mellicker j...@dvcreators.net wrote:
 Let's say you had a data grid table with three columns, and you wanted the 
 first column to be the sum of the other two, like this:

 10      7       3
 5       2       3
 7       4       3

 How would you calculate the first column while the table is filling in?


 ---

 Originally, we looped through the data and did the calculations, then put the 
 data into the data grid. Now the data set is getting so large that this is 
 too slow, looping through once to calc, then again for the grid. So we're 
 thinking doing the calculation in FillInData would be more efficient. If 
 possible.

 It's easy to find any field value in a Data Grid form, since pData is an 
 array with the row values, but we'd like to avoid switching to a 
 form.___
 use-revolution mailing list
 use-revolution@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution