Hi everyone, |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It Is there a way to access the filter saved in a view without actually loading the view? For example, something along the lines of getViewDescription(ViewDef vd), which can be accessed without loading the view. For the record, invalid filer rules cause a DOORS dialog to appear and halt DXL processing. An invalid filter rule becomes an issue when it is saved in a view and that view is loaded. Invalid filter rules are filters that depend on a particular attribute to be present that is no longer present. |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It I doubt it would work, but try loading the view in batch mode and see if you can detect any errors. -Louie |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It SystemAdmin - Sat Mar 16 11:02:59 EDT 2013 I wonder if it possible to SAVE a view with an invalid "Filter", such as define a "Filter" for attribute A in module 2, and somehow save that filter in module 1 (that lacks attribute A). -Louie Back to the original problem; I wonder how the "Manage Views" dialog works; it sure seems to get at view information without loading the various views. |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It llandale - Fri Mar 15 12:37:36 EDT 2013 llandale, I don't believe DOORS lets views be loaded in batch mode. I gave it a try, however, and confirmed the views won't load using "load(m, v)" unless the module is visible. Can you explain more about what you mean by overriding the native box functions using print()? |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It SystemAdmin - Mon Mar 18 00:33:20 EDT 2013
warningBox("This is the native warningBox")
void warningBox(string Message)
{ print "warningBox override: " Message "\n"
}
warningBox("This is overridden")
|
Re: How to Identify a View With an Invalid Filter Rule Before Loading It llandale - Mon Mar 18 10:58:10 EDT 2013
warningBox("This is the native warningBox")
void warningBox(string Message)
{ print "warningBox override: " Message "\n"
}
warningBox("This is overridden")
I tried this warningBox override approach but the "DOORS Report" dialog still appeared when I programmatically loaded the view with an invalid filter rule. I noticed that the dialog title for a truly DXL-generated "warning box" was simply "DOORS," whereas the dialog that is produced when loading a view with an invalid filter rule is "DOORS Report," which leads me to believe they are different types of dialogs. Thanks again for all the helpful ideas... let me know if you have any other thoughts! |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It SystemAdmin - Mon Mar 18 14:26:55 EDT 2013 |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It llandale - Mon Mar 18 17:23:40 EDT 2013
The following is a cunning way to look for bad filters in views.
// Check module for bad filters in views
/*
Tony Goodman.
*/
Skip viewNames = createString
/******************************************************************************
checkModuleForBadFilters
******************************************************************************/
string checkModuleForBadFilters(string modName)
{
Module m = null
Filter f = null
string vn = ""
string defViewUser = ""
m = read(modName, false)
if (null m) return("Error opening module")
// get the user's default view - we need to restore this later
defViewUser = getDefaultViewForUser(m)
// get list of views
for vn in views(m) do
{
put(viewNames, vn, vn)
}
// set each view as default in turn and re-open the module
for vn in viewNames do
{
print("Checking view \"" vn "\"\n")
setDefaultViewForUser(m, vn)
close(m)
m = read(modName, false)
// if filtering is ON, but the filter is null, then we have found a bad filter
if (filtering(m))
{
f = current
if (null f)
{
print("**** View \"" vn "\" contains a bad filter\n")
}
}
}
// reset the user's default view (if there was one)
if (!null defViewUser)
{
setDefaultViewForUser(m, defViewUser)
}
return("")
}
string res = checkModuleForBadFilters("/AMG/RPE Test")
print(res)
|
Re: How to Identify a View With an Invalid Filter Rule Before Loading It Tony_Goodman - Tue Mar 19 07:02:53 EDT 2013
The following is a cunning way to look for bad filters in views.
// Check module for bad filters in views
/*
Tony Goodman.
*/
Skip viewNames = createString
/******************************************************************************
checkModuleForBadFilters
******************************************************************************/
string checkModuleForBadFilters(string modName)
{
Module m = null
Filter f = null
string vn = ""
string defViewUser = ""
m = read(modName, false)
if (null m) return("Error opening module")
// get the user's default view - we need to restore this later
defViewUser = getDefaultViewForUser(m)
// get list of views
for vn in views(m) do
{
put(viewNames, vn, vn)
}
// set each view as default in turn and re-open the module
for vn in viewNames do
{
print("Checking view \"" vn "\"\n")
setDefaultViewForUser(m, vn)
close(m)
m = read(modName, false)
// if filtering is ON, but the filter is null, then we have found a bad filter
if (filtering(m))
{
f = current
if (null f)
{
print("**** View \"" vn "\" contains a bad filter\n")
}
}
}
// reset the user's default view (if there was one)
if (!null defViewUser)
{
setDefaultViewForUser(m, defViewUser)
}
return("")
}
string res = checkModuleForBadFilters("/AMG/RPE Test")
print(res)
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14776304� I don't think you need to close the module and re-load it; issuing the "read" when it's aleady open is sufficient. However, you may need to turn filtering off first in order to use your "the filtering property is set to true, but the filter itself is null" algorithm. I didn't try it, but trapping with noError/lastError the "read" may also suffice. -Louie |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It From what I can tell, Tony's algorithm no longer works in the latest version of DOORS if the filter was defined with multiple rules and at least one is still applicable. The offending rule is removed from the filter, but the current Filter, rather than being null, still contains any valid rules. From some fiddling around, I do not believe that applying an invalid filter will put anything useful in lastError() either. I could really use a way to run through my database and look for bad views, but I am out of ideas. |
Re: How to Identify a View With an Invalid Filter Rule Before Loading It I can confirm that Tony's approach no longer works with DOORS 9.6.1.9 because his second assumption is no longer true: "When a view with a bad filter is loaded then the filtering property is set to true, but the filter itself is null." When a view with a bad filter is loaded, the filtering property is not set to true. Tony, any new ideas on this subject? |