Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change the WHERE Expression on the fly
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00298657
Message ID:
00298666
Vues:
14
I think your problem goes to the data schema. It appears that you have separate fields in your Notes table for each type of ID and this is going to make your life difficult in the long run. If Notes can be a child of more than one table, then you need a compound key of the foreign key (ID) and the source of the ID. So, instead of having Notes.idis_sysid and Notes.iPub_sysid, you need to have Notes.FK_sysid and Notes.FKSource. FK_sysid would be the pub_sysID or dis_sysid and FKSource wouldbe "Supplier" or "Distributor". Then, your Notes form could be called with a parameter indicating the source, that parameter is stored to a form property (call it cNoteSource) and the view becomes:

SELECT * FROM notes WHERE notes.fksource = THISFORM.cNoteSource AND notes.FK_sysID = ?ParentPKValue.

See?


>Hi,
>
>Is there a away to change the WHERE expression without
>creating the entire view ? (I could not find any)
>
>I have a Notes form, that need to serve 2 other forms like supplier
>and one for distributor. If I use the same view for both forms then I
>need to change the filter expression on the fly ?
>
>I could NOT see away to do it with DBSETPROP() as of now.
>
>I would need to change the actual field it instead of :
>
> WHERE Notes.idis_sysid = ?ParentPKValue
>
>To:
>
> WHERE Notes.iPub_sysid = ?ParentPKValue
>
>Thanks
>
>Doron
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform