on 06-12-2018 8:23 AM
Hi,
I have a requirement where i want to assign a <Dummy> domain to all the data items which have <undefined> data type and <undefined> domain; in a conceptual data model (CDM)
The number of such fields is huge, hence would prefer doing this via a script in one of the extensions.
Can someone please help me with the code. I have the below code which seems to be not working:
Sub %Method%(obj)
' (here) obj = conceptual data model
dim data_item, dummy_domain, assign_domain, e
assign_domain = "Dummy"
' loop over all data items in the model
for each data_item in obj.dataitems
for each dummy_domain in obj.domains
if data_item.dataType = "" and dummy_domain.name = "" then
dummy_domain.SetNameAndCode assign_domain, assign_domain
end if
next
next
output "Done!!!"
End Sub
Hello Amit
You don't need a script, as you can change all affected Data Items with a single action in a list of Domains, or in a List Report. I would use a List Report, as that saves the filtering for you. Here's what you do:
In one of the rows, select the required domain:
Every selected Data Item is assigned to the selected domain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi George,
Thanks a lot for your quick replies on my issue. It worked for me both ways.
Thanks again 🙂
--Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this script:
dim DIT, DOM, DOMName, domTest
DOMName = "@Dummy"
set DOM = ActiveModel.FindChildByName(DOMName, Cls_Domain)
output DOM
for each DIT in ActiveModel.DataItems
'output DIT & " - " & DIT.DataType
if DIT.DataType = "" then
output DIT & " is undefined"
set domTest = DIT.Domain
if domTest is Nothing then
output " - has no domain - Domain set to " & domName
DIT.Domain = DOM
ElseIf Not domTest.Name = DOMName then
output " - has the wrong domain [" & domTest.Name & "] - Domain changed to " & domName
DIT.Domain = DOM
End If
end if
next
output "Done!!!"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.