sorry, i'm a noob to this. i've written the following attempting to add attributes to a physical model but below when i attempt:
MyAttribute.DefaultName = "timestamp now"
it doesn't work.
i'm tryin g to set the default value from the data dictionary defaults.
Dim MyDiagram As Diagram
Dim MyModel As Model
Dim MyEntity As Entity
Dim MyAttribute As AttributeObj
Set MyDiagram = DiagramManager.ActiveDiagram
Set MyModel = MyDiagram.ActiveModel
If Not MyModel.Logical Then
If MsgBox("This macro will add audit columns to all objects.", vbOkCancel) = vbOK Then
For Each MyEntity In MyModel.Entities
Set MyAttribute = MyEntity.Attributes.Add("create_date", False)
MyAttribute.Datatype = "TIMESTAMP"
MyAttribute.Definition = "The datetime the record was created."
MyAttribute.NullOption = "NOT NULL"
MyAttribute.DefaultName = "timestamp now" 'not working
MsgBox "This macro is designed to run in the Physical model. Please switch to Physical model first."
figured it out:
For Each MyDefaults In MyDiagram.Dictionary.Defaults
If MyDefaults.Name = "timestamp now" Then
Set MyTimestampNowDefaultId = MyDefaults.ID
MyAttribute.DefaultId = MyTimestampNowDefaultId
Hi, 192.168.l.lThere was the same problem, thanks for the helpful information.
I'm doing something very similar, would you share the completed script? Did you add a dictionary entry manually that you reference? Thanks for any info!
I am having the same problem and I'm so glad that there are people out there that are answering your question, cheers to that! https://www.fortcollinsdeckbuilders.com/
This has been helpful. I've encountered the same issue. Thanks a lot!
Powered by IDERA