Я пытаюсь создать CDM, импортировав электронную таблицу Excel в PD через VBS.
1 - загрузить электронную таблицу 2 - создать CDM 3 - создать элементы данных с расширенными атрибутами.
Я могу загрузить и создать CDM и создать элементы данных, если у меня нет расширенных атрибутов, однако я не могу создавать расширенные атрибуты в VBS - но мне нужно создать расширенные атрибуты для загрузкиостальная часть таблицы.Любые идеи.
Код в настоящее время выглядит так:
> Option Explicit
>
> InteractiveMode = im_Dialog
>
> Dim Model, objExcel, objWorkbook, intRow, LogFile, lobj, MyExa Set
> Model = ActiveModel Dim MyModel, t, r, sym set MyModel =
> CreateModel(PdCDM.Cls_Model,"DBMS=SYASA12")
>
>
> Set objExcel = CreateObject("Excel.Application") Set objWorkbook =
> objExcel.Workbooks.Open ("C:\Users\ Models\09.
> Dictionary\DataDictionaryTestImport.xlsx")
>
> intRow = 2
>
> DIM Name, Stewards, LongDescription, ParentCategory,
> DomainSubCategory, BusinessUnit, BusinessUnitArea,
> BusinessUnitDepartment, Calculations, DataOwner, ValidationRule,
> DataQualityBusinessRules, Format, SourceSystemName,
> GoldenSourceSystem, ElementType DIM v_tp
>
>
> Do Until objExcel.Cells(intRow,1).Value = "" Name =
> objExcel.Cells(intRow, 1).Value Stewards = objExcel.Cells(intRow,
> 2).Value LongDescription = objExcel.Cells(intRow, 3).Value
> ParentCategory = objExcel.Cells(intRow, 4).Value
> DomainSubCategory = objExcel.Cells(intRow, 5).Value
> BusinessUnit = objExcel.Cells(intRow, 6).Value
> BusinessUnitArea = objExcel.Cells(intRow, 7).Value
> BusinessUnitDepartment = objExcel.Cells(intRow, 8).Value
> Calculations = objExcel.Cells(intRow, 9).Value DataOwner =
> objExcel.Cells(intRow, 10).Value DataQualityBusinessRules =
> objExcel.Cells(intRow, 11).Value ValidationRule =
> objExcel.Cells(intRow, 12).Value Format = objExcel.Cells(intRow,
> 13).Value SourceSystemName = objExcel.Cells(intRow, 14).Value
> GoldenSourceSystem = objExcel.Cells(intRow, 15).Value
> ElementType = objExcel.Cells(intRow, 16).Value
> Set t=MyModel.dataitems.CreateNew()
> t.Name = objExcel.Cells(intRow, 1).Value
> CreateAttributes t
> Logger LogFile, Year(Date) & "-" & Month(Date) & "-" & Day(Date) & " " & Time & " - Object: " & name
> intRow = intRow + 1 loop
> 'Create Data Items For idx = 1 to 12
> Next
>
> 'Log file Sub Logger (LogFilename, LogText) Dim fso Dim LogFile Set fso = CreateObject("Scripting.FileSystemObject") Set
> LogFile = fso.OpenTextFile(LogFilename, 8, True) LogFile.WriteLine
> LogText End Sub
>
>
> Function CreateAttributes(t) Dim attr Set attr =
> t.CreateObject(Pdcdm.cls_Attribute) t=MyModel.dataitems.CreateNew()
> attr.Name = "ID" attr.Code = "ID" attr.DataType = "int"
> attr.Persistent = True attr.PersistentCode = "ID"
> attr.PersistentDataType = "I" attr.PrimaryIdentifier = True Set attr
> = t.CreateObject(Pdcdm.cls_Attribute) attr.Name = "Name" attr.Code = "Name" attr.DataType = "String" attr.Persistent = True
> attr.PersistentCode = "NAME" attr.PersistentDataType = "A30"
>
> CreateAttributes = True End Function