| Author |
Compound Index fields and Masterdetail
|
|
| Tom Gormley 2006-12-12, 7:13 pm |
| I have and compound index "ordercode" which consists is defined as
supplier - stockcode. The help system indicates that more that one field can be used doesnt give example syntax.
I just get a error message
qEdiData.rowset.indexName = "Ordercode"
qEdiData.rowset.masterRowset = qPlof.rowset // Identify master rowset
qEdiData.rowset.masterFields = "supplier,stockcode" // fields names
*** help doesnt give syntax for multiple fields
| |
| Rick Gearardo 2006-12-12, 7:13 pm |
| I don't think you can do multiple fields. Use r.setRange on the child row
instead.
Rick
"Tom Gormley" <tom@sirius-is.co.uk> wrote in message
news:lBOSBdhHHHA.1524@news-server...
>I have and compound index "ordercode" which consists is defined as
> supplier - stockcode. The help system indicates that more that one field
> can be used doesnt give example syntax.
> I just get a error message
>
> qEdiData.rowset.indexName = "Ordercode"
> qEdiData.rowset.masterRowset = qPlof.rowset // Identify master rowset
> qEdiData.rowset.masterFields = "supplier,stockcode" // fields names
>
> *** help doesnt give syntax for multiple fields
| |
| Glenn Johansen 2006-12-13, 7:12 pm |
| sure you can do multiple fields.
Create a custom field.
eg
q = new Query()
q.sql := "select * from LINEITEM"
q.active := true
c = new Field()
c.fieldName := "Total"
q.rowset.fields.add(c)
c.beforeGetValue := {||this.parent["Quantity"].value *
this.parent["PricePer"].value}
set the beforegetvalue to your complex expression.
use this field in the masterfields.
--
Glenn Johansen
Software Architects, Inc.
(864) 963-8402
"Tom Gormley" <tom@sirius-is.co.uk> wrote in message
news:lBOSBdhHHHA.1524@news-server...
> I have and compound index "ordercode" which consists is defined as
> supplier - stockcode. The help system indicates that more that one field
can be used doesnt give example syntax.
> I just get a error message
>
> qEdiData.rowset.indexName = "Ordercode"
> qEdiData.rowset.masterRowset = qPlof.rowset // Identify master rowset
> qEdiData.rowset.masterFields = "supplier,stockcode" // fields names
>
> *** help doesnt give syntax for multiple fields
| |
| Eric Logan 2006-12-13, 7:12 pm |
| > "Tom Gormley" wrote ...
> I have and compound index "ordercode" which consists is defined as
> supplier - stockcode. The help system indicates that more that one field
can be used doesnt give example syntax.
> I just get a error message
> qEdiData.rowset.indexName = "Ordercode"
> qEdiData.rowset.masterRowset = qPlof.rowset // Identify master rowset
> qEdiData.rowset.masterFields = "supplier,stockcode" // fields names
> *** help doesnt give syntax for multiple fields
Tom;
There is a way to do this. It isn't quite as simple as the old 'set
relation', but it seems to work in a similar way. Your masterfields needs to
be a new (temporary) field created in your master rowset in the onopen event
of the query creating the master rowset. That new field is defined (via its
beforegetvalue) as a complex expression with values corrresponding to the
active index key values in the linked rowset. As I recall, once the onopen
procedure is written and the form saved, the new field can be selected as
masterfields when you inspect the child rowset.
I have copied fragments from a working example to illustrate.
E.L.
*************
Angldat31 is the query generating the masterrowset.
Biodat21 is the query generating the child rowset.
*************
function angldat31_onOpen
local nf
nf = new field()
nf.fieldName := "BioLink"
form.angldat31.rowset.fields.add(nf)
nf.beforeGetValue =
{||DTOS(this.parent["Date"].value)+this.parent["AREA"].value+this.parent["SA
MPLERS"].value+STR(this.parent["ANGLER_NUM"].value)}
return
with (this.BIODAT21.rowset)
indexName = "DTARSMPANG"
masterRowset = form.angldat31.rowset
masterFields = "BioLink"
endwith
************
|
|
|
|