Nadya,
Provided tLast_Updated_Date and cLast_Updated_User do not allow null values (and you do not recycle deleted records) then oldval('tLast_Updated_Date') will yield null for an insert, not null for an update
If they do allow null values, you may have to use the table again and do a seek() in the table_again_alias.
if( set('datasession') > 1 ) you can assume you are in a forms private datasession, so you do not have to close the table_again_alias
Don't know the framework but I would update those fields for an insert if I were you
>Gregory,
>
>How would I distingush between insert and update? I don't want to change these fields if it's a new record. I only want to update them if I'm changing the record. Also is there an easy way to find the PK field?
>
>>Nadya,
>>
>>I think you can do so in the RecordValidation rule of the base tables
>>
>>You can use getfldstate(-1)
>>
>>For inserts, just replace tLast_Updated_Date and cLast_Updated_User
>>
>>For updates, loop using getfldstate(-1) and if getfldstate(-1) indicates a change for a field, compare the fieldvalue to the oldval() in case a field is changed and reset to its old value
>>
>>The only drawback is that the RecordValidation rule does not fire for a delete as far as I can see. Don't know whether that is a problem for you
>>
>>
>>>Hi everybody,
>>>
>>>In our tables we have tLast_Updated_Date and cLast_Updated_User fields. How can we update these fields if we change our tables? Is it possible to do in a view? What if the view consists of several tables and two of them needs to be updated?
>>>
>>>How do you solve this problem?
>>>
>>>Thanks in advance.
Gregory