Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default value firing when it shouldn't
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Default value firing when it shouldn't
Miscellaneous
Thread ID:
00590220
Message ID:
00590220
Views:
243
I have 2 dbcs, WorkMan and WorkMan_Main.

WorkMan contains a local view called woSF_2. It is based on the woSF table in WorkMain_Main.

Both the view and the table have a default value set of getNextKey('woSF'). Each of the dbcs has a SP called getNextKey. I have put a wait wind in each of the SPs so I can see when each fires.

I can use the view from the command window, append a record (the WorkMan getNextKey fires), and then issue tableupdate(2, .t.) (the workman_main getNextKey does NOT fire). Cool.

Now I put the woSF_2 veiw in the DE of a form. I append a record (the WorkMan getNextKey fires), then I issue tableupdate(2, .t.) (And the workman_main getNextKey fires again)???

Anyone have any idea why it would fire twice?

Here is the view code:
***************** Begin View Definition WOSF_2 ***************

Create Sql View "WOSF_2" ;
	AS Select woSF.*, ;
	lu_space.cDesc As cSpace ;
	FROM workman_MAIN!woSF;
	LEFT Outer Join workman_MAIN!lu_space ;
	ON  woSF.fk_space_id = lu_space.pk_id ;
	WHERE woSF.fk_workorder_id = ?vp_curID ;
	ORDER By cSpace

DBSetProp('WOSF_2', 'View', 'UpdateType', 1)
DBSetProp('WOSF_2', 'View', 'WhereType', 3)
DBSetProp('WOSF_2', 'View', 'FetchMemo', .T.)
DBSetProp('WOSF_2', 'View', 'SendUpdates', .T.)
DBSetProp('WOSF_2', 'View', 'UseMemoSize', 255)
DBSetProp('WOSF_2', 'View', 'FetchSize', 100)
DBSetProp('WOSF_2', 'View', 'MaxRecords', -1)
DBSetProp('WOSF_2', 'View', 'Tables', 'workman_MAIN!woSF')
DBSetProp('WOSF_2', 'View', 'Prepared', .F.)
DBSetProp('WOSF_2', 'View', 'CompareMemo', .T.)
DBSetProp('WOSF_2', 'View', 'FetchAsNeeded', .T.)
DBSetProp('WOSF_2', 'View', 'FetchSize', 100)
DBSetProp('WOSF_2', 'View', 'Comment', "")
DBSetProp('WOSF_2', 'View', 'BatchUpdateCount', 1)
DBSetProp('WOSF_2', 'View', 'ShareConnection', .T.)

*!* Field Level Properties for WOSF_2
* Props for the WOSF_2.pk_id field.
DBSetProp('WOSF_2.pk_id', 'Field', 'KeyField', .T.)
DBSetProp('WOSF_2.pk_id', 'Field', 'Updatable', .T.)
DBSetProp('WOSF_2.pk_id', 'Field', 'UpdateName', 'workman_MAIN!woSF.pk_id')
DBSetProp('WOSF_2.pk_id', 'Field', 'DataType', "I")
<b>DBSetProp('WOSF_2.pk_id', 'Field', 'DefaultValue', "getNextKey('woSF')            ")</b>
* Props for the WOSF_2.fk_workorder_id field.
DBSetProp('WOSF_2.fk_workorder_id', 'Field', 'KeyField', .F.)
DBSetProp('WOSF_2.fk_workorder_id', 'Field', 'Updatable', .T.)
DBSetProp('WOSF_2.fk_workorder_id', 'Field', 'UpdateName', 'workman_MAIN!woSF.fk_workorder_id')
DBSetProp('WOSF_2.fk_workorder_id', 'Field', 'DataType', "I")
* Props for the WOSF_2.nsf field.
DBSetProp('WOSF_2.nsf', 'Field', 'KeyField', .F.)
DBSetProp('WOSF_2.nsf', 'Field', 'Updatable', .T.)
DBSetProp('WOSF_2.nsf', 'Field', 'UpdateName', 'workman_MAIN!woSF.nsf')
DBSetProp('WOSF_2.nsf', 'Field', 'DataType', "N(10)")
* Props for the WOSF_2.fk_space_id field.
DBSetProp('WOSF_2.fk_space_id', 'Field', 'KeyField', .F.)
DBSetProp('WOSF_2.fk_space_id', 'Field', 'Updatable', .T.)
DBSetProp('WOSF_2.fk_space_id', 'Field', 'UpdateName', 'workman_MAIN!woSF.fk_space_id')
DBSetProp('WOSF_2.fk_space_id', 'Field', 'DataType', "I")
* Props for the WOSF_2.nmin field.
DBSetProp('WOSF_2.nmin', 'Field', 'KeyField', .F.)
DBSetProp('WOSF_2.nmin', 'Field', 'Updatable', .T.)
DBSetProp('WOSF_2.nmin', 'Field', 'UpdateName', 'workman_MAIN!woSF.nmin')
DBSetProp('WOSF_2.nmin', 'Field', 'DataType', "N(10)")
* Props for the WOSF_2.yfee field.
DBSetProp('WOSF_2.yfee', 'Field', 'KeyField', .F.)
DBSetProp('WOSF_2.yfee', 'Field', 'Updatable', .T.)
DBSetProp('WOSF_2.yfee', 'Field', 'UpdateName', 'workman_MAIN!woSF.yfee')
DBSetProp('WOSF_2.yfee', 'Field', 'DataType', "Y")
* Props for the WOSF_2.cspace field.
DBSetProp('WOSF_2.cspace', 'Field', 'KeyField', .F.)
DBSetProp('WOSF_2.cspace', 'Field', 'Updatable', .F.)
DBSetProp('WOSF_2.cspace', 'Field', 'UpdateName', 'cspace')
DBSetProp('WOSF_2.cspace', 'Field', 'DataType', "C(50)")
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Next
Reply
Map
View

Click here to load this message in the networking platform