In PD 11 I did something like:
if not EntityAttributeExists(oTargetEntity.attributes,
sName, sDomain, sComment, bMandatory) then
'Try to find the data item.
Set dataItem = getDataItemObj(sName, sDomain, sComment)
if not (dataItem is nothing) then
'Reuse this data item.
Set newAttribute =
oTargetEntity.Attributes.CreateNewAt(oTargetEntity.attributes.count)
newAttribute.DataItem = dataItem
This works fine in PD 11 but in PD 12 it error on the
newAttribute.DataItem = dataItem line.
EntityAttribute
Cannot set value '' for attribute Data Item Information of
Entity Attribute 'EmployeeHistory.Attribute_194': Data Item
Information cannot be set to this value (Exception occurred.
(0x80020009))
At line 1256, character 8
Any Help would be great.
Amy
This could be because the getDataItemObj is returning an object,
therefore dataItem is not getting set to a valid object.data item you
are setting is not an actual object.
Or, you now have to turn validation mode off, assign the dataitem, turn
validation mode on.
Set cObj = pObj.Attributes.CreateNew()
Set nObj = cObj.DataItem
aFnd = False
ScanAttribute mdl, nm, aObj, aFnd
If aFnd Then
validationmode= false
set cObj.dataitem = aObj
validationmode= true
nObj.delete
nObj = cObj.DataItem
End If
What criteria are you using to determine whether to reuse or build new.
HTH,
-Matt C.
Matt Creason
<Amy> wrote in message news:49ca7667.244...@sybase.com...
THANKS.
The validationmode= false and validationmode= true did the
trick.
To answer your question on what criteria I am using to
create or reuse. If the exact dataitem already exists then
reuse it (99% of the time this is the case), if not create
one. That way one dataitem is shared amongst all of the
History tables. If I need to increase the size of the data
item, say from a varchar(50) to varchar(128) then I can just
do it in one spot. This is why the method that Randy was
suggesting was not correct for my situation.
Thanks again, Amy
> > tes.count) newAttribute.DataItem = dataItem