Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapters: How to set Default value and RuleExpress
Message
From
08/01/2004 14:31:15
Walter Meester
HoogkarspelNetherlands
 
 
To
08/01/2004 12:50:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00863700
Message ID:
00865194
Views:
27
>Hi Walter,

>I'm confused. I'd really like your more detailed opinion on this. There are cases where local databases are used but the data is accessed by more than one app and having the default values in the database reduces redundancy and the propensity for errors. I'd really like to know the reason why having the backend handle the default values is not preferred. Are you saying that default values should be handled by business rules on the client (I'm assuming you did not mean the UI where it would have to be duplicated)? I'm not sure I understand what you were recommending.


Hi tracy.

When using views in your from end application where the users view their data, the user sure likes to see the default values filled in when they add a record, and not after it has been saved and requeried.

I'm not going to say that your backend should not have any default values, but rather that they do make good sense on the client as well. I like to store the default values in views rather than the backend tables, since in most cases the application domain determines the default value, not the database domain.

When working directly on the local database (not through views) it makes sense, if you're doing local or remote views, default values (or calling functions to get the default value like a NEWKEY("TBL_PK") pk generating function) in the view does make more sense than relying on the backend. Some default values might be domain specific, others might be application specific. Here lies the much of the decision whether to handle them locally or remotely.

Walter,







>Thanks,
>Tracy
>
>>>Your database back-end should be assigning default values - not your client.
>>
>>Yeah right and I'm the pope.
>>This is the greateses nonsense I've ever heard.
>>
>>Of course in other environments (like .NEt) it might make sense, but not in an environment where you've got a local database.
>>
>>Walter,
>>
>>
>>
>>>>Hi,
>>>>
>>>>Is it possible to use default values and RuleExpressions in CursorAdapters?
>>>>
>>>>We would like to move our updateable views (with default values and code in RuleExpression) to cursor adapters. For the views we set all kinds of default values for fields:
>>>>
>>>>cStatus c(1) default 'I' RuleExpression 'FillStatusUpdate()',
>>>>tStatusUpdate t
>>>>
>>>>function FillStatusUpdate
>>>>replace tStatusUpdate with datetime()
>>>>return .t.
>>>>
>>>>Appending a record to the view based cursor fills the cStatus field with 'I'.
>>>>Updating the cStatus field fires the FillStatusUpdate() function.
>>>>BUT this doesn't work in CursorAdapter based cursors!!!
>>>>
>>>>Please help,
>>>>TIA
>>>>
>>>>Greetings,
>>>>Jean-Pierre.
Previous
Reply
Map
View

Click here to load this message in the networking platform