Prev: Help with C# Source
Next: VO2Ado Parameterized Query
From: Paul D B on 18 Nov 2009 09:24 Hi all, got a master DBf and a detail DBF, related by a common field ( e.g. client_nr) I need to show the master records in a bBrowser, with additional columns that have to show for each master record, the fields of the corresponding LAST detail record When using the traditional approach (Setrelation on the client_nr) I get the first detailrecord of each group. I'm wondering if there is some trick I'm missing (e.g. when using a dbserver:seek one cane use the [lLast] argument). Maybe I could work around it with a conditional and/or unique indexorder on the detail DBF, but for the moment I would like to avoid that. TIA -- Paul
From: emin on 18 Nov 2009 13:04 Hi Paul, I would try to use a Descend Order (CDX) in the detail DBF. In taht case Setrelation will Seek() always the first record of the groupe wich in fact is the last you need to show. TIA Ernesto > > Maybe I could work around it with a conditional and/or unique indexorder on > the detail DBF, but for the moment I would like to avoid that. > > TIA > > -- > Paul
From: Stephen Quinn on 18 Nov 2009 17:29 Paul You'll need to have a descending or custom index to achieve that. CYA Steve
From: Johan Nel on 18 Nov 2009 23:52 Hi Paul, As you indicated Seek is your partner if you use CDX... <oDBServer>:Seek(<uKey>, [<lSoftSeek>], [<lLast>]) ---> lFound <lLast> TRUE seeks the last occurrence of the specified key value. FALSE, the default, seeks the first occurrence. <lLast> only applies to CDX indexes. You can always have a variable that contains the current client_nr. Then as you move and DbServer:client_nr <> variable, do a Seek with lLast := TRUE. Think that will be your best bet. Regards, Johan Nel Pretoria, South Africa. Paul D B wrote: > Hi all, > > got a master DBf and a detail DBF, related by a common field ( e.g. > client_nr) > > I need to show the master records in a bBrowser, with additional columns > that have to show for each master record, the fields of the corresponding > LAST detail record > > When using the traditional approach (Setrelation on the client_nr) I get the > first detailrecord of each group. > > I'm wondering if there is some trick I'm missing (e.g. when using a > dbserver:seek one cane use the [lLast] argument). > > Maybe I could work around it with a conditional and/or unique indexorder on > the detail DBF, but for the moment I would like to avoid that. > > > TIA > >
From: Stephen Quinn on 19 Nov 2009 00:01
Paul > You'll need to have a descending or custom index to achieve that. I should qualify that by adding 'as long as your using a relation' If you don't use a relationship and set the index scope programmatically, you could use the Seek() method on DBServer. CYA Steve |