DataGrid Stuff

zryip theSlug zryip.theslug at
Mon Jul 12 15:52:45 EDT 2010

2010/7/12 Bob Sneidar <bobs at>:
> Not strictly true. His script worked fine if I named the columns "State" and "Code" respectively.

Or maybe not strictly true because I inverted the two sample preview
of what you will obtain in each case.
I pointed out here the two results obtain if you use or not the
firstLineContainsColumnNames parameter. And definitively not pointed
out that the script doesn't work.

So to correct things we have to read:

If firstLineContainsColumnNames is false, the grid will show this:

State         Code ---> Header of the Datagrid
state          code ---> First line of data
ALABAMA  AL   ---> Second line of data
ALASKA     AK  ---> Last line of data

If firstLineContainsColumnNames is true, the Grid will contain:

State         Code  ---> Header of the Datagrid
ALABAMA  AL    ---> First line of data
ALASKA     AK   ---> Last line of data

Finally, the better way is to create the two columns by code during
the importation of the data:

   if (firstLineContainsColumnNames) then
      if (the dgProp["columns"] of group "DataGrid 1" is empty) then
         put first line of theText into tHeaderLine
         replace tab with return in tHeaderLine
         set the dgProp["columns"] of group "DataGrid 1" to tHeaderLine
      end if
   end if

  set the dgText[firstLineContainsColumnNames] of group "MyDataGrid" to theText

Thanks Bob. I hope that you will found this answer strictly better
than the previous ;)

-Zryip TheSlug- wish you the best! 8)

More information about the Use-livecode mailing list