Using this nice script to print out the names of views for all modules in a project. I'd like to also print out the view description. anyone have a quick snippet that I can add to the for loop? |
Re: printing out a view description
Use this before and after your code to make it readable: "{ c o d e }", without the quotes nor spaces.
View viu
ViewDef vd
string Desc
Module m = read(fullName(parentItem), true)
current = m
print fullName m "\n"
string s
for s in views (m) do {
viu = view(s)
vd = get(m, viu)
Desc = getViewDescription (vd)
print "\t" s "\t'" Desc "'\n"
}
close m
|
Re: printing out a view description |
Re: printing out a view description SystemAdmin - Tue May 18 14:50:16 EDT 2010
for those who want it:
// script to list all views in all modules of a project, with their descriptions
// select the project folder, and cancel the first dialog, and ok the second one
// otherwise it will print for the entire database
void recurseFoldersForFormalModules( Item parentItem ) {
View viu
ViewDef vd
string Desc
//string Desc
string itemType = type( parentItem )
if ( ( itemType == "Folder" ) || ( itemType == "Project" ) ) {
Item childItem
for childItem in folder( parentItem ) do {
recurseFoldersForFormalModules( childItem )
}
}
if ( itemType == "Formal" ) {
print fullName( parentItem ) "\n"
Module m = read(fullName(parentItem), true)
//print fullName m "\n"
string s
for s in views (m) do {
Buffer b = create
viu = view(s)
vd = get(m, viu)
Desc = getViewDescription (vd)
b += Desc
print "\t" s "\t" b "\n"
delete b
}
close m
}
}
if (confirm("All Modules in entire database?")) recurseFoldersForFormalModules( item( "/" ) )
elseif(!null current Project and confirm("All modules in current Project and below"))
recurseFoldersForFormalModules( item( fullName(current Project)) )
elseif(confirm("All modules in current Folder and below?"))
recurseFoldersForFormalModules( item( fullName(current Folder)) )
else{} // nothing to do
|
Re: printing out a view description SystemAdmin - Tue May 18 14:56:21 EDT 2010
for those who want it:
// script to list all views in all modules of a project, with their descriptions
// select the project folder, and cancel the first dialog, and ok the second one
// otherwise it will print for the entire database
void recurseFoldersForFormalModules( Item parentItem ) {
View viu
ViewDef vd
string Desc
//string Desc
string itemType = type( parentItem )
if ( ( itemType == "Folder" ) || ( itemType == "Project" ) ) {
Item childItem
for childItem in folder( parentItem ) do {
recurseFoldersForFormalModules( childItem )
}
}
if ( itemType == "Formal" ) {
print fullName( parentItem ) "\n"
Module m = read(fullName(parentItem), true)
//print fullName m "\n"
string s
for s in views (m) do {
Buffer b = create
viu = view(s)
vd = get(m, viu)
Desc = getViewDescription (vd)
b += Desc
print "\t" s "\t" b "\n"
delete b
}
close m
}
}
if (confirm("All Modules in entire database?")) recurseFoldersForFormalModules( item( "/" ) )
elseif(!null current Project and confirm("All modules in current Project and below"))
recurseFoldersForFormalModules( item( fullName(current Project)) )
elseif(confirm("All modules in current Folder and below?"))
recurseFoldersForFormalModules( item( fullName(current Folder)) )
else{} // nothing to do
You definately need to get that create(buffer) command out of the loop. Creating and deleting Buffers, for some reason, takes a (relatively) huge amount of time compared to using them. Create the buffer before the loop, set it to blanks at the top of the loop, delete it after the loop.
Buffer bufRecurseFolders = create()
void recurseFoldersForFormalModules( Item parentItem ) {
...
for s in views (m) do {
bufRecurseFolders = ""
...
|