Datagrid stopper out of the gate

Jim Ault jimaultwins at yahoo.com
Mon Jul 19 08:02:36 EDT 2010


I found MY scripting problem.
The header was written as follows:

put "Post, Race, Track, City, State" into hdr
replace comma with tab in hdr
-- thus col 2-5 had a leading space which was invisible, just as the  
tab char is.


Correct data casting is
put "Post,Race,Track,City,State" into hdr
replace comma with tab in hdr

Discovery
Column naming is white space sensitive.

Thanks for the quick reply.

Jim Ault
Las Vegas

>
> On Jul 19, 2010, at 3:09 AM, zryip theSlug wrote:
>
>> On Mon, Jul 19, 2010 at 11:23 AM, Jim Ault <jimaultwins at yahoo.com>  
>> wrote:
>>> I am doing a quick study of the Datagrid object and getting a  
>>> confusing
>>> result.
>>> For me, there is a time-deadline this week, so I need to figure  
>>> this out
>>> quickly.
>>>
>>> Defining a datagrid group, five columns, then running the  
>>> following stack
>>> script
>>> --   Rev 3.5.0   build 860
>>> --   relaunch and open only the test stack
>>>
>>> on testLoadDgrd   --postTimeDgrd
>>>  get the cpGTasklist of this stack
>>>    --using tab delimited lines
>>>  get line 1 to 11 of IT
>>>  set the clipboarddata to line 2 to -1 of IT
>>>  put true into keyy
>>>  set the dgText[keyy] of  group "postTimeDgrd" to IT
>>> end testLoadDgrd
>>>
>>
>> set the clipboarddata to line 2 to -1 of IT
>> put true into keyy
>> set the dgText[keyy] of  group "postTimeDgrd" to IT
>>
>> Assuming that the first line of IT contains your headers, the error
>> should be here.
>> By using the dgText[true] property, you specify to the data grid
>> library that the first line of the data, contains the column header.
>> In this case the DG engine try to make corresponding the data with  
>> the
>> column names of the data grid.
>> However here the first line passed to the DG is:
>> 09:34     1     FLX     Farmington     NY
>>
>> One of those solutions should resolve the problem:
>>
>> set the clipboarddata to line 2 to -1 of IT
>> put false into keyy
>> set the dgText[keyy] of  group "postTimeDgrd" to IT
>>
>> For using this second solution, the columns of your DG must be  
>> named with
>> Post      Race      Track      City      State
>> respectively
>>
>> set the clipboarddata to line 1 to -1 of IT
>> put true into keyy
>> set the dgText[keyy] of  group "postTimeDgrd" to IT
>>




More information about the Use-livecode mailing list