Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Default overriding local view key
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Table Default overriding local view key
Miscellaneous
Thread ID:
00744416
Message ID:
00744416
Views:
37
Hi Foxperts,

I've got a view that, for some reason, is having its primary key field re-evaluated (using the database/table default property) even though the view contains the valid key already!? I've traced through at execution to determine this to be happening on the tableupdate. I set the primary key calling the stored procedure spNewID that generates unique keys when I create the view record rather than having it populated later. That way, child views can get their parent id as well. This has worked for me in the past!

Why would this happen (that it doesn't respect the primary key field already set and instead wants to get a new primary key)?

Here's the view definition. I opened it up in the ViewDesigner also and nothing stood out as wrong. I've got the primary key (orderid) identified and its updatable. ????

lcViewName = "vuOrders"
CREATE SQL VIEW "vuOrders" as ;
SELECT orders.orderid, orders.userid, orders.customerid, orders.shipname, orders.shipaddr1, ;
orders.shipaddr2, orders.shipcity, orders.shipstate, orders.shipzip, orders.confirmation, ;
orders.orderdate, orders.delivdate, orders.shipdate, orders.trackno, ;
orders.notes, MAX(t1.statusdate) as lastdate, NVL(t1.status,SPACE(10)) as status, ;
orders.delflag ;
FROM sdnp!orders ;
LEFT JOIN sdnp!tracking t1 ;
ON orders.orderid == t1.orderid ;
WHERE orders.orderid = ?vp_OrderID

DBSetProp(lcViewName, 'View', 'UpdateType', 1)
DBSetProp(lcViewName, 'View', 'WhereType', 1)
DBSetProp(lcViewName, 'View', 'FetchMemo', .T.)
DBSetProp(lcViewName, 'View', 'SendUpdates', .T.)
DBSetProp(lcViewName, 'View', 'UseMemoSize', 255)
DBSetProp(lcViewName, 'View', 'FetchSize', 1)
DBSetProp(lcViewName, 'View', 'MaxRecords', 1)
DBSetProp(lcViewName, 'View', 'Tables', 'sdnp!Orders')
DBSetProp(lcViewName, 'View', 'Prepared', .T.)
DBSetProp(lcViewName, 'View', 'CompareMemo', .F.)
DBSetProp(lcViewName, 'View', 'FetchAsNeeded', .F.)
DBSetProp(lcViewName, 'View', 'Comment', "")
DBSetProp(lcViewName, 'View', 'BatchUpdateCount', 1)
DBSetProp(lcViewName, 'View', 'ShareConnection', .T.)

DBSetProp(lcViewName + '.orderid', 'Field', 'KeyField', .T.)
DBSetProp(lcViewName + '.orderid', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.userid', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.customerid', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipname', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipaddr1', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipaddr2', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipcity', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipstate', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipzip', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.confirmation', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.orderdate', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.delivdate', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.shipdate', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.trackno', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.notes', 'Field', 'Updatable', .T.)
DBSetProp(lcViewName + '.delflag', 'Field', 'Updatable', .T.)


--Michael
Michael J. Babcock, MCP
President/CEO, MB Software Solutions
President/Founder, CPVFUG (Central Pennsylvania Visual Foxpro User Group)
mbsoftwaresolutions.com
cpvfug.org
mbabcock@mbsoftwaresolutions.com

"Providing solutions that help your people work smarter, not harder, to better your bottom line."
Reply
Map
View

Click here to load this message in the networking platform