In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Example of oDataSet:SetRelation Needed
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
I'm trying to create a form with two oDbfBrowse objects with the dataset in
one browse object being the parent and the dataset of the other browse
object showing child records.
In the form initialize event, I set the relationship like this:
METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
with object ::oDbfDataSetAssignedPrecincts
:Open()
:AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
:AddIdxFile("CAVCPREP") // ECODE+PRCODE
SET ORDER TO 1
end with
with object ::oDbfDataSetConNames
:Open()
:AddIdxFile("CAVCONID") // IDNO
:AddIdxFile("CAVCONEC") // ECODE+CONNAME
SET ORDER TO 2
:SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
:GoTop()
end with
::oDbfBrowseConNames:SetDBF("CAVCONSL")
::oDbfBrowseConNames:GoTop()
::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
::oDbfBrowseAssignedPrecincts:GoTop()
::oDbfBrowseConNames:SetFocus()
RETURN Nil
The child browse object shows every record in the
oDbfDataSetAssignedPrecincts, rather than just child records of the active
row in the parent browse object.
What am I doing wrong?
one browse object being the parent and the dataset of the other browse
object showing child records.
In the form initialize event, I set the relationship like this:
METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
with object ::oDbfDataSetAssignedPrecincts
:Open()
:AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
:AddIdxFile("CAVCPREP") // ECODE+PRCODE
SET ORDER TO 1
end with
with object ::oDbfDataSetConNames
:Open()
:AddIdxFile("CAVCONID") // IDNO
:AddIdxFile("CAVCONEC") // ECODE+CONNAME
SET ORDER TO 2
:SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
:GoTop()
end with
::oDbfBrowseConNames:SetDBF("CAVCONSL")
::oDbfBrowseConNames:GoTop()
::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
::oDbfBrowseAssignedPrecincts:GoTop()
::oDbfBrowseConNames:SetFocus()
RETURN Nil
The child browse object shows every record in the
oDbfDataSetAssignedPrecincts, rather than just child records of the active
row in the parent browse object.
What am I doing wrong?
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
You should set the oDataset:SetScope() on the child area on the master table
TBrowse:OnChange event.
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
> I'm trying to create a form with two oDbfBrowse objects with the dataset
> in one browse object being the parent and the dataset of the other browse
> object showing child records.
> In the form initialize event, I set the relationship like this:
>
> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>
> with object ::oDbfDataSetAssignedPrecincts
> :Open()
> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
> SET ORDER TO 1
> end with
>
> with object ::oDbfDataSetConNames
> :Open()
> :AddIdxFile("CAVCONID") // IDNO
> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
> SET ORDER TO 2
> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
> :GoTop()
> end with
>
> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
> ::oDbfBrowseConNames:GoTop()
>
> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
> ::oDbfBrowseAssignedPrecincts:GoTop()
>
> ::oDbfBrowseConNames:SetFocus()
>
> RETURN Nil
>
> The child browse object shows every record in the
> oDbfDataSetAssignedPrecincts, rather than just child records of the active
> row in the parent browse object.
> What am I doing wrong?
You should set the oDataset:SetScope() on the child area on the master table
TBrowse:OnChange event.
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
> I'm trying to create a form with two oDbfBrowse objects with the dataset
> in one browse object being the parent and the dataset of the other browse
> object showing child records.
> In the form initialize event, I set the relationship like this:
>
> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>
> with object ::oDbfDataSetAssignedPrecincts
> :Open()
> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
> SET ORDER TO 1
> end with
>
> with object ::oDbfDataSetConNames
> :Open()
> :AddIdxFile("CAVCONID") // IDNO
> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
> SET ORDER TO 2
> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
> :GoTop()
> end with
>
> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
> ::oDbfBrowseConNames:GoTop()
>
> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
> ::oDbfBrowseAssignedPrecincts:GoTop()
>
> ::oDbfBrowseConNames:SetFocus()
>
> RETURN Nil
>
> The child browse object shows every record in the
> oDbfDataSetAssignedPrecincts, rather than just child records of the active
> row in the parent browse object.
> What am I doing wrong?
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Example of oDataSet:SetRelation Needed
Gary,
You should set the oDataset:SetScope() on the child area on the master table
TBrowse:OnChange event.
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
> I'm trying to create a form with two oDbfBrowse objects with the dataset
> in one browse object being the parent and the dataset of the other browse
> object showing child records.
> In the form initialize event, I set the relationship like this:
>
> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>
> with object ::oDbfDataSetAssignedPrecincts
> :Open()
> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
> SET ORDER TO 1
> end with
>
> with object ::oDbfDataSetConNames
> :Open()
> :AddIdxFile("CAVCONID") // IDNO
> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
> SET ORDER TO 2
> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
> :GoTop()
> end with
>
> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
> ::oDbfBrowseConNames:GoTop()
>
> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
> ::oDbfBrowseAssignedPrecincts:GoTop()
>
> ::oDbfBrowseConNames:SetFocus()
>
> RETURN Nil
>
> The child browse object shows every record in the
> oDbfDataSetAssignedPrecincts, rather than just child records of the active
> row in the parent browse object.
> What am I doing wrong?
You should set the oDataset:SetScope() on the child area on the master table
TBrowse:OnChange event.
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
> I'm trying to create a form with two oDbfBrowse objects with the dataset
> in one browse object being the parent and the dataset of the other browse
> object showing child records.
> In the form initialize event, I set the relationship like this:
>
> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>
> with object ::oDbfDataSetAssignedPrecincts
> :Open()
> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
> SET ORDER TO 1
> end with
>
> with object ::oDbfDataSetConNames
> :Open()
> :AddIdxFile("CAVCONID") // IDNO
> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
> SET ORDER TO 2
> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
> :GoTop()
> end with
>
> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
> ::oDbfBrowseConNames:GoTop()
>
> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
> ::oDbfBrowseAssignedPrecincts:GoTop()
>
> ::oDbfBrowseConNames:SetFocus()
>
> RETURN Nil
>
> The child browse object shows every record in the
> oDbfDataSetAssignedPrecincts, rather than just child records of the active
> row in the parent browse object.
> What am I doing wrong?
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Ignacio,
That works well and doesn't require any relationships to be set, however, I
would still benefit if you or someone would present a small example of using
the odbfDataSet:SetRelation() method. Is oForm:Initialize() the correct
place to set relations? Is the syntax of the example I gave below correct?
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
That works well and doesn't require any relationships to be set, however, I
would still benefit if you or someone would present a small example of using
the odbfDataSet:SetRelation() method. Is oForm:Initialize() the correct
place to set relations? Is the syntax of the example I gave below correct?
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Ignacio,
That works well and doesn't require any relationships to be set, however, I
would still benefit if you or someone would present a small example of using
the odbfDataSet:SetRelation() method. Is oForm:Initialize() the correct
place to set relations? Is the syntax of the example I gave below correct?
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
That works well and doesn't require any relationships to be set, however, I
would still benefit if you or someone would present a small example of using
the odbfDataSet:SetRelation() method. Is oForm:Initialize() the correct
place to set relations? Is the syntax of the example I gave below correct?
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
Example:
// CODE is a field name on DBF child table
// CLIENT is a field name on DBF master table
// When master table changes its position xHarbour seeks on child table
based on master CLIENT field value
with object oDS:Child
:Open()
:AddIdxFile("CODE")
:OrdSetFocus( "CODE" )
end with
with object oDS:Master
:Open()
:SetRelation("CLIENT", oDSChild)
:GoTop()
end with
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:48dbbb13$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> That works well and doesn't require any relationships to be set, however,
> I would still benefit if you or someone would present a small example of
> using the odbfDataSet:SetRelation() method. Is oForm:Initialize() the
> correct place to set relations? Is the syntax of the example I gave below
> correct?
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
Example:
// CODE is a field name on DBF child table
// CLIENT is a field name on DBF master table
// When master table changes its position xHarbour seeks on child table
based on master CLIENT field value
with object oDS:Child
:Open()
:AddIdxFile("CODE")
:OrdSetFocus( "CODE" )
end with
with object oDS:Master
:Open()
:SetRelation("CLIENT", oDSChild)
:GoTop()
end with
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:48dbbb13$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> That works well and doesn't require any relationships to be set, however,
> I would still benefit if you or someone would present a small example of
> using the odbfDataSet:SetRelation() method. Is oForm:Initialize() the
> correct place to set relations? Is the syntax of the example I gave below
> correct?
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Example of oDataSet:SetRelation Needed
Gary,
Example:
// CODE is a field name on DBF child table
// CLIENT is a field name on DBF master table
// When master table changes its position xHarbour seeks on child table
based on master CLIENT field value
with object oDS:Child
:Open()
:AddIdxFile("CODE")
:OrdSetFocus( "CODE" )
end with
with object oDS:Master
:Open()
:SetRelation("CLIENT", oDSChild)
:GoTop()
end with
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:48dbbb13$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> That works well and doesn't require any relationships to be set, however,
> I would still benefit if you or someone would present a small example of
> using the odbfDataSet:SetRelation() method. Is oForm:Initialize() the
> correct place to set relations? Is the syntax of the example I gave below
> correct?
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
Example:
// CODE is a field name on DBF child table
// CLIENT is a field name on DBF master table
// When master table changes its position xHarbour seeks on child table
based on master CLIENT field value
with object oDS:Child
:Open()
:AddIdxFile("CODE")
:OrdSetFocus( "CODE" )
end with
with object oDS:Master
:Open()
:SetRelation("CLIENT", oDSChild)
:GoTop()
end with
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
news:48dbbb13$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> That works well and doesn't require any relationships to be set, however,
> I would still benefit if you or someone would present a small example of
> using the odbfDataSet:SetRelation() method. Is oForm:Initialize() the
> correct place to set relations? Is the syntax of the example I gave below
> correct?
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Ignacio,
I've been playing with oDbfDataSet:SetScope() and thought I had it working,
but find that I do not.
The help file uses the parameter syntax "xTop" and "xBottom". What does the
x stand for?
Here is what I am trying in the oDbfBrowse:onChange event of the Parent
dataset:
::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
The dataset oDbfDataSetAssignedPrecincts is the child dataset.
The dataset oDbfDataSetConNames is the parent dataset.
Both datasets have the field Idno (character, 15-character length).
The child table is indexed on the field Idno plus another field. It is the
only index and debug shows it active.
The child table does have records in it that have an Idno value equal to the
Idno value in the parent table.
If I comment out the above SetScope line, the child browse object shows all
child records, so I do have a valid browse object on the form.
If I uncomment the SetScope line, I see no child records in the child browse
object no matter what parent record I click on in the parent browse object.
Is the compound index key in the index file for the child table causing me
problems? In Clipper, I could seek on the first part of a compound key
successfully.
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
I've been playing with oDbfDataSet:SetScope() and thought I had it working,
but find that I do not.
The help file uses the parameter syntax "xTop" and "xBottom". What does the
x stand for?
Here is what I am trying in the oDbfBrowse:onChange event of the Parent
dataset:
::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
The dataset oDbfDataSetAssignedPrecincts is the child dataset.
The dataset oDbfDataSetConNames is the parent dataset.
Both datasets have the field Idno (character, 15-character length).
The child table is indexed on the field Idno plus another field. It is the
only index and debug shows it active.
The child table does have records in it that have an Idno value equal to the
Idno value in the parent table.
If I comment out the above SetScope line, the child browse object shows all
child records, so I do have a valid browse object on the form.
If I uncomment the SetScope line, I see no child records in the child browse
object no matter what parent record I click on in the parent browse object.
Is the compound index key in the index file for the child table causing me
problems? In Clipper, I could seek on the first part of a compound key
successfully.
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Ignacio,
I've been playing with oDbfDataSet:SetScope() and thought I had it working,
but find that I do not.
The help file uses the parameter syntax "xTop" and "xBottom". What does the
x stand for?
Here is what I am trying in the oDbfBrowse:onChange event of the Parent
dataset:
::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
The dataset oDbfDataSetAssignedPrecincts is the child dataset.
The dataset oDbfDataSetConNames is the parent dataset.
Both datasets have the field Idno (character, 15-character length).
The child table is indexed on the field Idno plus another field. It is the
only index and debug shows it active.
The child table does have records in it that have an Idno value equal to the
Idno value in the parent table.
If I comment out the above SetScope line, the child browse object shows all
child records, so I do have a valid browse object on the form.
If I uncomment the SetScope line, I see no child records in the child browse
object no matter what parent record I click on in the parent browse object.
Is the compound index key in the index file for the child table causing me
problems? In Clipper, I could seek on the first part of a compound key
successfully.
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
I've been playing with oDbfDataSet:SetScope() and thought I had it working,
but find that I do not.
The help file uses the parameter syntax "xTop" and "xBottom". What does the
x stand for?
Here is what I am trying in the oDbfBrowse:onChange event of the Parent
dataset:
::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
The dataset oDbfDataSetAssignedPrecincts is the child dataset.
The dataset oDbfDataSetConNames is the parent dataset.
Both datasets have the field Idno (character, 15-character length).
The child table is indexed on the field Idno plus another field. It is the
only index and debug shows it active.
The child table does have records in it that have an Idno value equal to the
Idno value in the parent table.
If I comment out the above SetScope line, the child browse object shows all
child records, so I do have a valid browse object on the form.
If I uncomment the SetScope line, I see no child records in the child browse
object no matter what parent record I click on in the parent browse object.
Is the compound index key in the index file for the child table causing me
problems? In Clipper, I could seek on the first part of a compound key
successfully.
TIA,
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gary,
>
> You should set the oDataset:SetScope() on the child area on the master
> table TBrowse:OnChange event.
>
> Regards,
>
>
>
> --
> Ignacio Ortiz de Zúñiga
> [Soporte Xailer]
> [Xailer support]
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>> in one browse object being the parent and the dataset of the other browse
>> object showing child records.
>> In the form initialize event, I set the relationship like this:
>>
>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>
>> with object ::oDbfDataSetAssignedPrecincts
>> :Open()
>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>> SET ORDER TO 1
>> end with
>>
>> with object ::oDbfDataSetConNames
>> :Open()
>> :AddIdxFile("CAVCONID") // IDNO
>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>> SET ORDER TO 2
>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>> :GoTop()
>> end with
>>
>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>> ::oDbfBrowseConNames:GoTop()
>>
>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>
>> ::oDbfBrowseConNames:SetFocus()
>>
>> RETURN Nil
>>
>> The child browse object shows every record in the
>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>> active row in the parent browse object.
>> What am I doing wrong?
>
>
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
With further experimentation, I found that I needed to issue an explicit
GoTop() after the SetScope(). I was thinking that the third parameter
[lGoFirst] would do that for me, but it did not.
Thanks,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message
news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> I've been playing with oDbfDataSet:SetScope() and thought I had it
> working, but find that I do not.
> The help file uses the parameter syntax "xTop" and "xBottom". What does
> the x stand for?
>
> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
> dataset:
>
>
> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>
> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
> The dataset oDbfDataSetConNames is the parent dataset.
> Both datasets have the field Idno (character, 15-character length).
> The child table is indexed on the field Idno plus another field. It is the
> only index and debug shows it active.
> The child table does have records in it that have an Idno value equal to
> the Idno value in the parent table.
> If I comment out the above SetScope line, the child browse object shows
> all child records, so I do have a valid browse object on the form.
> If I uncomment the SetScope line, I see no child records in the child
> browse object no matter what parent record I click on in the parent browse
> object.
>
> Is the compound index key in the index file for the child table causing me
> problems? In Clipper, I could seek on the first part of a compound key
> successfully.
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
GoTop() after the SetScope(). I was thinking that the third parameter
[lGoFirst] would do that for me, but it did not.
Thanks,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message
news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> I've been playing with oDbfDataSet:SetScope() and thought I had it
> working, but find that I do not.
> The help file uses the parameter syntax "xTop" and "xBottom". What does
> the x stand for?
>
> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
> dataset:
>
>
> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>
> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
> The dataset oDbfDataSetConNames is the parent dataset.
> Both datasets have the field Idno (character, 15-character length).
> The child table is indexed on the field Idno plus another field. It is the
> only index and debug shows it active.
> The child table does have records in it that have an Idno value equal to
> the Idno value in the parent table.
> If I comment out the above SetScope line, the child browse object shows
> all child records, so I do have a valid browse object on the form.
> If I uncomment the SetScope line, I see no child records in the child
> browse object no matter what parent record I click on in the parent browse
> object.
>
> Is the compound index key in the index file for the child table causing me
> problems? In Clipper, I could seek on the first part of a compound key
> successfully.
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
With further experimentation, I found that I needed to issue an explicit
GoTop() after the SetScope(). I was thinking that the third parameter
[lGoFirst] would do that for me, but it did not.
Thanks,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message
news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> I've been playing with oDbfDataSet:SetScope() and thought I had it
> working, but find that I do not.
> The help file uses the parameter syntax "xTop" and "xBottom". What does
> the x stand for?
>
> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
> dataset:
>
>
> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>
> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
> The dataset oDbfDataSetConNames is the parent dataset.
> Both datasets have the field Idno (character, 15-character length).
> The child table is indexed on the field Idno plus another field. It is the
> only index and debug shows it active.
> The child table does have records in it that have an Idno value equal to
> the Idno value in the parent table.
> If I comment out the above SetScope line, the child browse object shows
> all child records, so I do have a valid browse object on the form.
> If I uncomment the SetScope line, I see no child records in the child
> browse object no matter what parent record I click on in the parent browse
> object.
>
> Is the compound index key in the index file for the child table causing me
> problems? In Clipper, I could seek on the first part of a compound key
> successfully.
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
GoTop() after the SetScope(). I was thinking that the third parameter
[lGoFirst] would do that for me, but it did not.
Thanks,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message
news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> I've been playing with oDbfDataSet:SetScope() and thought I had it
> working, but find that I do not.
> The help file uses the parameter syntax "xTop" and "xBottom". What does
> the x stand for?
>
> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
> dataset:
>
>
> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>
> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
> The dataset oDbfDataSetConNames is the parent dataset.
> Both datasets have the field Idno (character, 15-character length).
> The child table is indexed on the field Idno plus another field. It is the
> only index and debug shows it active.
> The child table does have records in it that have an Idno value equal to
> the Idno value in the parent table.
> If I comment out the above SetScope line, the child browse object shows
> all child records, so I do have a valid browse object on the form.
> If I uncomment the SetScope line, I see no child records in the child
> browse object no matter what parent record I click on in the parent browse
> object.
>
> Is the compound index key in the index file for the child table causing me
> problems? In Clipper, I could seek on the first part of a compound key
> successfully.
>
> TIA,
> Gary
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Gary,
>>
>> You should set the oDataset:SetScope() on the child area on the master
>> table TBrowse:OnChange event.
>>
>> Regards,
>>
>>
>>
>> --
>> Ignacio Ortiz de Zúñiga
>> [Soporte Xailer]
>> [Xailer support]
>>
>>
>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>> in one browse object being the parent and the dataset of the other
>>> browse object showing child records.
>>> In the form initialize event, I set the relationship like this:
>>>
>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>
>>> with object ::oDbfDataSetAssignedPrecincts
>>> :Open()
>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>> SET ORDER TO 1
>>> end with
>>>
>>> with object ::oDbfDataSetConNames
>>> :Open()
>>> :AddIdxFile("CAVCONID") // IDNO
>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>> SET ORDER TO 2
>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>> :GoTop()
>>> end with
>>>
>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>> ::oDbfBrowseConNames:GoTop()
>>>
>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>
>>> ::oDbfBrowseConNames:SetFocus()
>>>
>>> RETURN Nil
>>>
>>> The child browse object shows every record in the
>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>> active row in the parent browse object.
>>> What am I doing wrong?
>>
>>
>
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Example of oDataSet:SetRelation Needed
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Ignacio,
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
-
- Mensajes: 202
- Registrado: Dom Feb 17, 2008 3:35 am
Example of oDataSet:SetRelation Needed
Ignacio,
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
Sorry, try with:
oDbf1:SetRelation("'CCIVIL '+CACCIVIL->Idno",oDbf2)
Regards
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aae6474@svctag-j7w3v3j....]4aae6474@svctag-j7w3v3j....[/email]
Ignacio,
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Sorry, try with:
oDbf1:SetRelation("'CCIVIL '+CACCIVIL->Idno",oDbf2)
Regards
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aae6474@svctag-j7w3v3j....]4aae6474@svctag-j7w3v3j....[/email]
Ignacio,
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
- ignacio
- Site Admin
- Mensajes: 9440
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Example of oDataSet:SetRelation Needed
Gary,
Sorry, try with:
oDbf1:SetRelation("'CCIVIL '+CACCIVIL->Idno",oDbf2)
Regards
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aae6474@svctag-j7w3v3j....]4aae6474@svctag-j7w3v3j....[/email]
Ignacio,
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Sorry, try with:
oDbf1:SetRelation("'CCIVIL '+CACCIVIL->Idno",oDbf2)
Regards
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aae6474@svctag-j7w3v3j....]4aae6474@svctag-j7w3v3j....[/email]
Ignacio,
I think I will have to go with SET RELATION in the case of a compound index with a literal string. I still get an error when I try:
oDbf1:SetRelation("CCIVIL +CACCIVIL->Idno",oDbf2)
Unless we left out a character delimiter in the above example, I think that SetRelation expects the first parameter to be a character field name, not a literal string. SET RELATION, on the other hand, can handle this situation.
Thanks,
Gary
"Ignacio Ortiz de Zúñiga" <NoNameToAvoidSpam@xailer.com> wrote in message news:[email=4aae05e5@svctag-j7w3v3j....]4aae05e5@svctag-j7w3v3j....[/email]
Gary,
First of all, you can create the relation with the SET RELATION command, there should not be any problem at ll, but of course, you can also use the TDbfDataset:SetRelation() method but you must indicate de alias, for example:
oDbf1:SetRelation( "CCIVIL +Dbf->Idno", oDbf2 )
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:[email=4aadb7b5@svctag-j7w3v3j....]4aadb7b5@svctag-j7w3v3j....[/email]
Related Question: Can :SetRelation() take more than one field as a parameter if the child has a compound index key?
For example: ::oDbfDataSetParent:SetRelation("Module"+"Idno",::oDbfDataSetChild,.T.)
If I wanted a string literal plus a field as a compound key, is that possible? For example: ::oDbfDataSetParent:SetRelation("CCIVIL " + "Idno", ::oDbfDataSetChild,.T.) where "CCIVIL " is a literal string and Idno is a field.
TIA,
Gary
"Gary S. Rogers" <g.s.rogers@att.net> wrote in message news:[email=48dd10e7@ozsrv2.ozlan.local...]48dd10e7@ozsrv2.ozlan.local...[/email]
I'm sorry, the GoTop() I was referring to was for the child browse object. The SetScope does perform a GoTop() on the dataset, but I'm learning some of the newbie stuff as far as Xailer goes and I somehow I expected the browse object to automatically reflect the dataset. So, in the change event of the parent browse object, I SetScope on the child dataset AND then issue a GoTop() on that child browse object. This works perfectly.
Gary
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message news:48dc9848$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Gary,
Really strange. Please take a look at the code of the SetScope method. I believe GoTop() is been called correctly.
Regards,
//---------------------------------------------------------- ----------------
METHOD SetScope( xTop, xBottom, lGoFirst, lUpd ) CLASS XDbfDataSet
LOCAL cTag
LOCAL nTag
DEFAULT lGoFirst TO .T.
DEFAULT lUpd TO ::lUpdLinked
cTag := ( ::cAlias )->( OrdName() )
( ::cAlias )->( OrdScope( TOPSCOPE, xTop ) )
IF xBottom != Nil
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xBottom ) )
ELSE
( ::cAlias )->( OrdScope( BOTTOMSCOPE, xTop ) )
xBottom := xTop
ENDIF
IF lGoFirst
::GoTop()
ENDIF
nTag := AScan( ::aScopes, {|v| v[ 1 ] == cTag } )
IF nTag == 0
AAdd( ::aScopes, Array( 3 ) )
nTag := Len( ::aScopes )
ENDIF
::aScopes[ nTag, 1 ] := cTag
::aScopes[ nTag, 2 ] := xTop
::aScopes[ nTag, 3 ] := xBottom
IF lUpd
::UpdateControls( XA_DSNAV_OTHER )
ENDIF
RETURN Nil
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:48dc0238$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> With further experimentation, I found that I needed to issue an explicit
> GoTop() after the SetScope(). I was thinking that the third parameter
> [lGoFirst] would do that for me, but it did not.
>
> Thanks,
> Gary
>
>
> "Gary S. Rogers" <g.s.rogers@att.net> wrote in message
> news:[email=48dbfdc5@ozsrv2.ozlan.local...]48dbfdc5@ozsrv2.ozlan.local...[/email]
>> Ignacio,
>>
>> I've been playing with oDbfDataSet:SetScope() and thought I had it
>> working, but find that I do not.
>> The help file uses the parameter syntax "xTop" and "xBottom". What does
>> the x stand for?
>>
>> Here is what I am trying in the oDbfBrowse:onChange event of the Parent
>> dataset:
>>
>>
>> ::oDbfDataSetAssignedPrecincts:SetScope(::oDbfDataSetConName s:Idno,::oDbfDataSetConNames:Idno,.T.,.T.)
>>
>> The dataset oDbfDataSetAssignedPrecincts is the child dataset.
>> The dataset oDbfDataSetConNames is the parent dataset.
>> Both datasets have the field Idno (character, 15-character length).
>> The child table is indexed on the field Idno plus another field. It is the
>> only index and debug shows it active.
>> The child table does have records in it that have an Idno value equal to
>> the Idno value in the parent table.
>> If I comment out the above SetScope line, the child browse object shows
>> all child records, so I do have a valid browse object on the form.
>> If I uncomment the SetScope line, I see no child records in the child
>> browse object no matter what parent record I click on in the parent browse
>> object.
>>
>> Is the compound index key in the index file for the child table causing me
>> problems? In Clipper, I could seek on the first part of a compound key
>> successfully.
>>
>> TIA,
>> Gary
>>
>>
>> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote in message
>> news:48d9eb18$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Gary,
>>>
>>> You should set the oDataset:SetScope() on the child area on the master
>>> table TBrowse:OnChange event.
>>>
>>> Regards,
>>>
>>>
>>>
>>> --
>>> Ignacio Ortiz de Zúñiga
>>> [Soporte Xailer]
>>> [Xailer support]
>>>
>>>
>>> "Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje
>>> news:[email=48d9c2d7@ozsrv2.ozlan.local...]48d9c2d7@ozsrv2.ozlan.local...[/email]
>>>> I'm trying to create a form with two oDbfBrowse objects with the dataset
>>>> in one browse object being the parent and the dataset of the other
>>>> browse object showing child records.
>>>> In the form initialize event, I set the relationship like this:
>>>>
>>>> METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
>>>>
>>>> with object ::oDbfDataSetAssignedPrecincts
>>>> :Open()
>>>> :AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
>>>> :AddIdxFile("CAVCPREP") // ECODE+PRCODE
>>>> SET ORDER TO 1
>>>> end with
>>>>
>>>> with object ::oDbfDataSetConNames
>>>> :Open()
>>>> :AddIdxFile("CAVCONID") // IDNO
>>>> :AddIdxFile("CAVCONEC") // ECODE+CONNAME
>>>> SET ORDER TO 2
>>>> :SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
>>>> :GoTop()
>>>> end with
>>>>
>>>> ::oDbfBrowseConNames:SetDBF("CAVCONSL")
>>>> ::oDbfBrowseConNames:GoTop()
>>>>
>>>> ::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
>>>> ::oDbfBrowseAssignedPrecincts:GoTop()
>>>>
>>>> ::oDbfBrowseConNames:SetFocus()
>>>>
>>>> RETURN Nil
>>>>
>>>> The child browse object shows every record in the
>>>> oDbfDataSetAssignedPrecincts, rather than just child records of the
>>>> active row in the parent browse object.
>>>> What am I doing wrong?
>>>
>>>
>>
>
--
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com