>(I have no idea about Codebook)
Forget it, it was just for referecen <g>.
Yipee, solved the thing... THISFORM is not valid from the DBC, _SCREEN.ACTIVEFORM is
>>_SCREEN.ACTIVEFORM.botRoutineTest.oLastRecord.iEngineID
works wonder <bg>.
Thanks for all your help, any pitfalls in the above solution.
>Bhavbhuti,
>(I have no idea about Codebook)
>The database objects are not part of a form. Define your NewID returning functions in DBC as stored procedures. Then it'd look like :
>
>myNewID('tablename')
>
>dbsetprop('ViewName.FieldName','Field','DefaultValue','myNewID("TableName")')
>
>Cetin
>
>>Hi Cetin I just tried you approach, first for default values. This is the default value I am putting in one field iEngineID, I want this ID to be populated with the last used value.
>>
>>THISFORM.botRoutineTest.oLastRecord.iEngineID
>>
>>I get this error:
>>
>>Object is not contained in a FORM.
>>
>>This was working well with my original logic posted of AfterNew(). The oLastRecord is a public (was protected) property.
>>
>>Any idea what I may have done wrong. I use CodeBook and this was the way I could get the last record details by SCATTERing to an object.
>>
>>
>>>>>OK so you want to manage from another table as metadata. How about doing your way but changing default/validation for view once at a suitable place (typically when metadata is edited and saved).
>>>>
>>>>Yes
>>>>
>>>>>
>>>>>ie : You could do like this :
>>>>>
>>>>>
>>>>>open data myData
>>>>>select metadata
>>>>>scan
>>>>> lcViewField = trim(VievName -'.'-ViewFieldName)
>>>>> DBSetProp(lcViewField,"FIELD","RuleText",FieldRuleText)
>>>>> DBSetProp(lcViewField,"FIELD","RuleExpression",FieldRuleExpr)
>>>>> DBSetProp(lcViewField,"FIELD","DefaultValue",FieldDefaultExpr)
>>>>>endscan
>>>>>
Cetin
>>>>
>>>>Wow that means that I can do this once (at time of reinstllation) and I can avoid unnecesary function calls.
>>>>
>>>>I will try this at the soonest.
>>>
>>>Yes. Also after doing that :
>>>compile database DBCName && VFP6 SP3 and later
>>>Cetin