Kbase P97103: Running or opening objects that use some calculated fields lead to the following error:
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/9/2008 |
|
Status: Unverified
FACT(s) (Environment):
OpenEdge 10.0B
OpenEdge 10.0B01 Service Pack
All Supported Operating Systems
SYMPTOM(s):
Running or opening objects that use some calculated fields lead to the following error:
Failed to add columns to the RowObjectTable.
Could not create Calculated Field <field name> from Repository.
Calculated Fields must be defined for an Entity.
CAUSE:
This situation occurs in 10.0B and 10.0B01 when entity data are re-imported for a table and that an SDO against this table has calculated fields. The calculated fields defined in an SDO become corrupted and unusable. This seems to happen since Dynamics provides the ability to reuse calculated fields (OE 10), which handles the calculated fields more as an entity data.
Note that the problem may occur during the next Dynamics Session (not the one that did entity re-import) because the entity data for the calculated field can remain cached.
CAUSE:
Bug# OE00112250
FIX:
Upgrade to OpenEdge 10.0B02 or later.
Alternatively the following describes a work around:
It is not possible to just redefine the calculated fields because it still exists ?partially? (duplicate errors).
The solution is to delete all instances of the calculated fields in all objects with the ROM tool, then recreate the calculated field from scratch afterwards. The only thing that is not lost is the calculate<calcFieldName> function in the Data Logic Procedure of the SDO.
On the other hand, once one is aware of the problem, it is possible to avoid it the next time there is an entity data to reload, by doing the following:
0) backup your icfdb database
1) Run dumpAllCalcfieldEntity.p (see bellow) before reloading the entity data
2) Reload the entity data
3) Restart the Dynamics session (entity data are cached)
5) Run reloadAllCalcFieldEntity.p
6) Restart your session again (entity data are cached again)
/*dumpAllCalcfieldEntity.p*/
DEF STREAM obj.
DEF STREAM inst.
OUTPUT STREAM obj TO dumpCalcfieldEntityObj.d.
OUTPUT STREAM inst TO dumpCalcfieldEntityInst.d.
DEF BUFFER ContObj FOR ryc_smartobject.
DEF BUFFER entityObjType FOR gsc_object_type.
FOR FIRST gsc_object_type NO-LOCK WHERE gsc_object_type.OBJECT_type_code = "calculatedfield"
,EACH ryc_smartobject NO-LOCK WHERE ryc_smartobject.OBJECT_type_obj = gsc_object_type.object_type_obj:
EXPORT STREAM obj ryc_smartobject.
FOR EACH ryc_object_instance NO-LOCK WHERE ryc_object_instance.smartobject_obj = ryc_smartObject.smartobject_obj
,EACH ContObj NO-LOCK WHERE ContObj.smartobject_obj = ryc_object_instance.Container_smartobject_obj
,FIRST entityObjType NO-LOCK WHERE
entityObjType.OBJECT_type_code = "Entity"
AND entityObjType.object_type_obj = ContObj.OBJECT_type_obj:
EXPORT STREAM inst ryc_object_instance.
END.
END.
OUTPUT STREAM obj CLOSE.
OUTPUT STREAM inst CLOSE.
/*reloadAllCalcFieldEntity.p*/
INPUT FROM dumpCalcfieldEntityObj.d.
REPEAT:
CREATE ryc_smartobject.
IMPORT ryc_smartobject NO-ERROR.
IF ERROR-STATUS:ERROR THEN UNDO, NEXT.
END.
INPUT CLOSE.
INPUT FROM dumpCalcfieldEntityInst.d..
REPEAT:
CREATE ryc_object_instance.
IMPORT ryc_object_instance NO-ERROR.
IF ERROR-STATUS:ERROR THEN UNDO, NEXT.
END.
INPUT CLOSE.
Note this solution is about 'hacking' the repository, hence the "backup the icfdb step"