Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forms and multiple relations
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00046117
Message ID:
00046163
Vues:
21
>>I've been battling with my grids again.
>>
>>Here's a sample of my tables I'm working with:
>>
>>SYSTEM.DBF (contains info on a specific piece of hardware, eg. mainframe, mini, server)
>>- hardwareid (unique i.d.)
>>- hardware info fields....
>>
>>PERIPH.DBF (contains info on the peripherals attached to each "system")
>>- hardwareid (to relate each peripheral to a piece of hardware)
>>- peripheral type id (to relate to Allcodes.codeno to display "full name", i.e. 'Printer')
>>- vendor id (to relate to Allcodes.codeno to display "full name", i.e. 'Hewlett Packard')
>>- more peripheral info fields....
>>
>>ALLCODES.DBF ("master" lookup data table for comboboxes etc.)
>>- codetype (type of 'code' such as peripheral, vendor, operating system to filter boxes)
>>- codeno (unique id)
>>- displayvalue ("full name" to be displayed on forms, i.e. "Hewlett Packard" or "DOS")
>>
>>I've got multiple pages within my System form which lists data related to a "System". My form's data environment contains my SYSTEM.DBF, PERIPHERAL.DBF, SOFTWARE.DBF and ALLCODES.DBF tables. Each of the first 3 tables have several fields which need to look up display values from Allcodes.dbf for various comboboxes and grids throughout the pages. Allcodes.dbf contains all combobox display values for all my tables in my database as was suggested by the UT.
>>
>>My question ... will I encounter any problems since I want multiple tables and fields to relate to my allmighty Allcodes.codeno field to pull up appropriate displayvalues in grids and comboboxes (some within the grids)?
>>
>>What's the best way to establish these multiple relations... graphically in the DE or manually via code (and as always where do I put it?)?
>>
>>As you can guess, I'm already encountering some problems and want to rule this option out.
>>

>>MTIA!
>>
>>Mandy
>
>My preferences are following:
>1. Don't use temp relationships.
>2. Use cursors as grid row sources.
>3. Create all needed cursors in Form.Load events.
>4. Close all cursors in Form.Destroy events.
>5. Have custom method (e.g. "updatetableXgrid") for each functional grid.
>6. This method would include Select-Sql command to collect all related records:
> Select tmpTablex
> Set Safety off
> Zap
> Set safety on
> Select * From TableX Into Array aTemp Where TableX.Codeno=Allcodes.Codeno
> Insert into tmpTablex From Array aTemp
> Thisform.grTablex.Refresh
>7. This method will be called any time you move pointer in master table.

Hi Mandy,
The only thing I'd add to Ed's list is a fuller explanation of linking ALLCODES to 2 or 3 different fields.

In this case, you'd load a copy of allcodes for EACH of your lookup fields. Let's say you will need to look up OS and Hardware fields, so in your dataenvironment you'd open one copy of ALLCODES with alias ALLCODES (the default) and a second copy with an alias of AC_HW (Allcodes/Hardware). Then in your select you'd expand to include both of these:

Select * From TableX Into Array aTemp Where TableX.Codeno=Allcodes.Codeno AND tablex.HWcode = AC_HW.codeno...

Remember that you can open multiple copies of a table with different aliases, and VFP treats them as separate tables.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform