pFirstLineContainsHeaders is being ignored in DataGrid

Peter Haworth pete at lcsql.com
Tue Dec 11 14:23:01 EST 2012


Hi Roger,
You can set the column names using another property, the dgProps["columns"]
of <yourdatagridname>.  That property is a list of column names, one per
line so you would set that property to the first lien of your file with the
column separator (comma, tab, etc) replaced with return.  After that, you
can either still set the firstlinecontainscolumns to true and present the
whole file as the dgText, or set it to false and just present lines 2 to -1
of your file as the dgtext.

If you need to somehow set the column labels to something different than
the column names, you can use the dgProps["column labels"], once again, one
column label per line.  Don't need to do that if the column labels you want
are the same as the column names.

lcSQL Software <http://www.lcsql.com>



On Tue, Dec 11, 2012 at 10:51 AM, Roger Eller
<roger.e.eller at sealedair.com>wrote:

> Hi Pete,
>
> Well this changes everything!  Literally!  So, if I wish to re-order the
> columns, this will fit the bill quite nicely.  Thank you for clarifying
> what this param actually does, Pete.
>
> Back to what I was trying to do... If I need the first line of the imported
> text file to define the header names of each column, I will need to script
> that manually for each column, right?
>
> I don't see any references to data grid properties like dgText in the LC
> dictionary.  There are a few lessons on the RunRev site, but I don't see an
> example of how to do this with a built-in function.  It's roll your own
> time, I guess.
>
> ~Roger
>
>
> On Tue, Dec 11, 2012 at 1:09 PM, Peter Haworth <pete at lcsql.com> wrote:
>
> > Hi Roger,
> > That parameter doesn't change the column names, it just defines the order
> > of the column data within each line of dgText.  If it's false, then the
> > dgText is expected to contain the column data in the order the columns
> are
> > defined to the datagrid.  When true, then the first line of dgText
> defines
> > the order of the column data by specifying the column names, for example
> > Col2,col1,Col3.
> >
> >
> > Pete
> > lcSQL Software <http://www.lcsql.com>
> >
> >
> >
> > On Tue, Dec 11, 2012 at 9:50 AM, Roger Eller <
> roger.e.eller at sealedair.com
> > >wrote:
> >
> > > Hi Klaus,
> > >
> > > Thanks for the quick reply, but I still can not get it to work as you
> > > describe.  I have tried in Revolution 4.0.0, LiveCode 5.5.1, and
> LiveCode
> > > 5.5.2.  Without any parameter, the grid is populated without the
> headers
> > > changing.  With the parameter [TRUE], the grid is not populated at all.
> > >
> > > ~Roger
> > >
> > >
> > >
> > > On Tue, Dec 11, 2012 at 11:27 AM, Klaus on-rev <klaus at major.on-rev.com
> > > >wrote:
> > >
> > > > Hi Roger,
> > > >
> > > > Am 11.12.2012 um 17:23 schrieb Roger Eller <
> > roger.e.eller at sealedair.com
> > > >:
> > > >
> > > > > According to this datagrid lesson, this should work but it does
> not.
> > > >  Could
> > > > > someone please confirm?
> > > > >
> > > > >
> > > >
> > >
> >
> http://lessons.runrev.com/s/lessons/m/datagrid/l/7309-how-do-i-populate-a-data-grid-with-data
> > > > >
> > > > > on mouseUp
> > > > >   answer file "Select a Tab Delimited text file:"
> > > > >   set the pFirstLineContainsHeaders of grp "DataGrid" to true
> > > > >   set the dgText [ pFirstLineContainsHeaders ] of grp "DataGrid" to
> > URL
> > > > > ("file:" & it)
> > > > > end mouseUp
> > > > >
> > > > > The headers remain as "Col 1"  "Col 2",  etc.
> > > >
> > > > "pFirstLineContainsHeaders" is not a property of the datagrid, but a
> > > > parameter for dgtext!
> > > >
> > > > So this will work:
> > > > ...
> > > >   set the dgText [TRUE] of grp "DataGrid" to URL ("file:" & it)
> > > > ...
> > > >
> > > > > ~Roger
> > > >
> > > > Best
> > > >
> > > > Klaus
> > > >
> > > > --
> > > > Klaus Major
> > > > http://www.major-k.de
> > > > klaus at major.on-rev.com
> > > >
> > > >
> > > > _______________________________________________
> > > > 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
> > > >
> > > _______________________________________________
> > > 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
> > >
> > _______________________________________________
> > 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
> >
> _______________________________________________
> 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