Subject Re: Master/Child Tables
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 8 Feb 2018 12:44:25 +0200
Newsgroups dbase.getting-started

On 2018-02-08 11:05 AM, WJS wrote:
> On 2018/02/07 11:55 AM, Mervyn Bick wrote:
>> this.S1 = new QUERY(this)
>>     with (this.S1)
>>        left = 11.0
>>        width = 3.0
>>        height = 1.0
>>        sql = 'select s.* from s s where s.reg = :rno union select t.*
>> from t t where t.reg = :rno order by data '
>>        params["rno"] = "" //***
>>        masterSource = form.r1.rowset
>>        active = true
>>     endwith
> Mervyn,
> In the above query you use params["rno"] = "" (I marked it with //***)
> I still use dBase 2.6.2 and that is not required when using masterSource.
> i know you are using dBase 11, so my question is, is this a new
> requirement for the new dBase ?
> Wian

It is not necessary.

As long as the mastersource rowset is assigned one can add the 'where
fieldname = :parameter' in the sourcecode editor and the form will run
as expected.  The params[] entry is not required.

If one adds the parameter in the select statement without assigning the
mastersource the form gives an error.  If the params[] entry is there
there won't be an error but the child records will not be selected if
the mastersource is not set.

If the form is altered in any way in the designer the designer will
stream out the line even though dBASE doesn't need it in the constructor
code to work properly.

It looks as if this line is generated automatically in memory if it
isn't in the constructor code.  Because it's there the designer then
streams it out with the rest of the code.