Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change the WHERE Expression on the fly
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00298657
Message ID:
00298666
Views:
15
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform