Goofy question about Datagrids

Roger Eller roger.e.eller at sealedair.com
Wed Nov 2 18:15:06 CET 2016


If you want to total a column in a simple table field, assuming column 8,
this is my long-winded approach.

on mouseUp
   set the itemDel to TAB
   constant tColumn = 8
   constant tFieldName = "myFakeSpreadsheet"
   put the number of lines of fld tFieldName into tLineCount
   if line -1 of fld tFieldName contains "TOTALS:" then
      delete line -1 of fld tFieldName
      put cr & "TOTALS:" after fld tFieldName
   else
      put cr & "TOTALS:" after fld tFieldName
   end if
   repeat for each line thisLine in fld tFieldName
      put item tColumn of thisLine & comma after tListOfNumbers
   end repeat
   put sum(tListOfNumbers) into tTotal
   put tTotal into item tColumn of line -1 of fld tFieldName
end mouseUp

~Roger


On Wed, Nov 2, 2016 at 11:31 AM, Bob Sneidar <bobsneidar at iotecdigital.com>
wrote:

> It's my impression that Datagrids make terrible spreadsheets as is. But so
> does the table field. A LOT of work has to be done on both to get them to
> act like a spreadsheet. As it turns out, a spreadsheet is a quite
> complicated thing to implement. If you intend to do calculations, then
> there is a whole layer of vast complexity unto itself. Relative vs.
> absolute references? Mixed references? What happens when you insert a cell,
> row or column? Can you paste data in? How will it format?
>
> I can't believe you are shooting for all this complexity, but rather are
> only trying to create a way to display, and perhaps manipulate tabular
> data. In that case, I'd go with the table field.
>
> Bob S
>
>
> > On Nov 1, 2016, at 12:29 , Richmond <richmondmathewson at gmail.com> wrote:
> >
> > Possibly . . .
> >
> > But what I really meant was "what advantage does a datagrid have over a
> tableField vis-a-vis
> > spreadsheet handling?"
> >
> > Sorry; finding it rather difficult to formulate an uneasy feeling I've
> had about datagrids ever
> > since they were first introduced.
> >
> > Richmond.
> >
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list