Home > Archive > Programming with dBASE > November 2005 > Re: relations in db5.7









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: relations in db5.7
Rouke Bakker

2005-11-26, 8:32 pm

Hello Gerald,

Thanks for your reply and especially your example. Although I have been
using complex views similar to the one you provided, I did produce them
in the query designer and then modified them to give some tables more
meaningful alias names. It is encouraging to see that other programmers
use similar setups. However, I used this simple example to try to
explain my problem. I can usually find a work-around. For this
particular problem I left the relation bit out of the view, and set the
relation only just before creating the report where I needed it. But I
wanted to know what the correct method is to create a form, because
occasionally I come across this problem again and spend a lot of time
trying to figure out why something doesn't work, until I realize that
the relation of other tables affects a third table.

Regards,

--
Rouke

Gerald Lightsey wrote:
> On Mon, 21 Nov 2005 12:02:34 +1300, in the dbase.programming group,
> Rouke Bakker said...
>
>
>
> When I used to work in VdB 5.x I never used the Query Builder to build
> the .QBE files used in conjunction with forms applications. The Query
> Builder was known to create problematic code.
>
> A VdB 5.x .QBE file essentially just creates a VIEW of your data and you
> can easily write your own code for that. In your case if your tables
> were named One, Two and Three and Two is to be related to One and Three
> is to be free-standing your .QBE would look something like this.
>
> * Bakker.QBE
> use one order <whatever> in select()
> use two order <another> in select()
> use three order <yetanother> in select()
> select one
> set relation to <match another> into two constrain
> go top
> * end of Ba

kker.QBE
>
> Your code of course can be considerably more complex. The following is
> an example from one of my old VdB 5.x applications. The example shows
> that you can have tables bound into a relation and still have other
> instances of the same table free-standing using a different alias which
> you can manipulate just about any way you desire.
>
> * Logs.QBE
> close databases
> use projects order Proj_Nam in select()
> use projects order Proj_nam in select() alias Proj_nam
> use owners order Autoinc in select()
> use owners order Firm_nam in select() alias OwnerName
> use managers order Autoinc in select()
> use managers order Firm_nam in select() alias ManagerName
> use architec order Autoinc in select()
> use architec order Firm_nam in select() alias ArchitectName
> use architec order Autoinc in select() alias BPArchitect
> use gc order Autoinc in select()
> use gc order Firm_nam in select() alias GCName
> use ownerrep order Autoinc in select()
> use ownerrep order Firm in select() alias OwnerRepName
> use cmcontac order Autoinc in select()
> use cmcontac order Firm in select() alias CMContacName
> use arcontac order Autoinc in select()
> use arcontac order Firm in select() alias ArcontacName
> use arcontac order Autoinc in select() alias BPArcontac
> use GCrep order Autoinc in select()
> use GCrep order Firm in select() alias GCrepName
> use bidpacs order ProjAuto in select()
> use bidpacs order ProjAuto in select() alias BidPacBrowse
> use bidpacs order BPCompDTE in select() alias BPCompDTE
> use contrctr order Autoinc in select()
> use contrctr order Firm_nam in select() alias ContractorName
> use contrrep order Autoinc in select()
> use contrrep order Firm in select() alias ContractorRepName
> use costchng order BPAuto in select()
> use costchng order Autoinc in select() alias Cost2
> use docinfo order BPAuto in select()
> use lastnum order bybp in select()
> use spec_div in select()
> use submit order ToSubSect in select()
> use submit order usd2spec in select() alias SubLastNo
> use submit order usd2subsec in select() alias submitlink
> use spec_def order allfields in select() alias sections
> select docinfo
> set relation to CCauto into Cost2
> set relation to projects-> autoinc+bpauto+spec_
no+subitem+spec_sub into
> submitlink
> go top
> select bidpacs
> set relation to Firm into contrctr, Rep into Contrrep, ;
> Architect into BPArchitect, ArcContac into BPArcontac
> go top
> select projects
> set relation to Owner into Owners,;
> Owner_rep into Ownerrep,CManager into Managers,;
> CM_contac into CMcontac,Architect into Architec,;
> ArcContac into Arcontac,GC into GC,;
> GC_contac into GCrep
> go top
> * end of Logs.QBE
>
> Gerald


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com