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:
00298722
Views:
15
Hi John

Both keys are integer from the parents, and you are suggesting to
have one foreign key to serve the 2 parents right ? when I update the
notes view, if the parent is Distributor I just add the value "Distributor"
into the cNoteSource. In terms of design as data modeling it is not
legit but... I work with xCase thus based on that the Notes table will be
floating with no relations to both parents. But it should very well
work.

Thanks

Doron

>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
Previous
Reply
Map
View

Click here to load this message in the networking platform