PowerDesigner script: Delete unused data Items

Source: Internet
Author: User
Tags powerdesigner
Script
'*****************************************************************************
' File: Delete useless data items.vbs
' Version: 1.0
' Copyright: Floodzhu (floodzhu@hotmail.com), 2005.1.6
' Function: traverse the conceptual model and delete the useless data items.
'*****************************************************************************
Dim index
index = 0

Dim model ' current model '
Set model = Activemodel


If (model is nothing) Then
MsgBox "There are currently no active models. "
ElseIf not model. IsKindOf (Pdcdm.cls_model) Then
MsgBox "The current model is not a conceptual model. "
Else
View model
MsgBox Index & "a useless field was deleted. "
End If

'*****************************************************************************
' Function: View
' Function: Recursive traversal
'*****************************************************************************
Sub View (folder)
Dim item
For each item in folder. Dataitems
If not item. Isshortcut Then
VISIT Item
End If
Next

' Recursively for subdirectories
Dim subfolder
For each subfolder in folder. Packages
View subfolder
Next
End Sub

'*****************************************************************************
' Function: Visit
' Function: Processing node
'*****************************************************************************
Sub Visit (node)
If node. Usedby= "" Then
Node.delete
index = index + 1
End If
End Sub


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.