Subject Re: Derive grid's fieldName
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sun, 24 Oct 2021 11:43:20 -0700
Newsgroups dbase.getting-started

On 10/24/2021 9:39 AM, Akshat Kapoor wrote:
> Good Evening Tom,
>
>> dBase 2019
>> Windows 10
>>
>> Hi all,
>>
>> I am trying to derive the table field name that my grid column is
>> attached to via program. That would be the word 'testdate' in the
>> following example.The method escapes me at the moment. Your help would
>> be appreciated.
>>
>>       columns["Column1"] = new GRIDCOLUMN(form.GRID1)
>>        with (columns["Column1"])
>>           dataLink = form.qdata.rowset.fields["testdate"]
>>           editorType = 1    // EntryField
>>           width = 90.0
>>        endwith
>
> I did try this out.
> But failed.
> 2 forms are attached.
> In test_grid.wfm columns are not defined. Just grid is datalinked to a
> rowset.
>
> I get error in ?form.grid1.columns["Column1"].datalink
> The error is "Variable undefined"
>
> I then made changes and the form is test_grid2
> (Not much changed please review the code once)
> ?form.grid1.columns["Column1"].datalink
> is just displaying "object"
>
> Till it displays form.customers1.rowset.fields["customerid"] I am unable
> to extract any other info.
>
> I even tried ?form.grid1.columns["Column1"].datalink.value ,
> ?&form.grid1.columns["Column1"].datalink
>
> But was unable to make any progress.
> I am using plus 12 on windows 10

The problem is dataLink is an object reference, so you're going to have
to drill down further. Take a look at outputting the baseClassName or
ClassName properties of the objects to figure out where you are while
doing this.

Ken



--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm