Filtering on Null Value

I am trying to create a filter on null values and the filter is not working. Is showing data with values.

Is there a defect in DOORS 9.3 related to this issue?
 

print length((current Object)."Deviation""")""
 
filtering off
 
for obj in current Module do{
    string s = obj."Deviation"""
        int len = length(s)
        if(len > 0){
                if(len == 1){
                        char c = s[len]
                        print (intOf c)"\t"
                }
                print identifier(obj) "\t" len "\t Accept\n" 
                accept obj
        }
        else{
                print identifier(obj) "\t" len "\t Rejected\n" 
                reject obj
        }
}
 
filtering on

SystemAdmin - Wed Apr 11 17:24:25 EDT 2012

Re: Filtering on Null Value
SystemAdmin - Wed Apr 11 23:40:40 EDT 2012

Seems to me that it is showing objects with values in the "Deviation" attribute because the conditional logic in your script is set to "accept obj" when the string length is greater than zero - so all objects that have some text in the "Deviation" attribute will be visible when the filter is turned on.

Perhaps you meant the script to be the other way around - swap the "reject obj" and "accept obj" functions.


Paul Miller
Melbourne, Australia

Re: Filtering on Null Value
Mathias Mamsch - Mon Apr 16 05:23:50 EDT 2012

By the way, this code will not work:
 

if(len == 1) {
   char c = s[len]  // use len-1 here, string begin with a 0 index
   print (intOf c)"\t"
}

 


maybe that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Filtering on Null Value
llandale - Mon Apr 16 09:42:35 EDT 2012

Mathias Mamsch - Mon Apr 16 05:23:50 EDT 2012

By the way, this code will not work:
 

if(len == 1) {
   char c = s[len]  // use len-1 here, string begin with a 0 index
   print (intOf c)"\t"
}

 


maybe that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Yes. This illustrates it:

void    PrintString(string in_String)
{     int len = length(in_String), i
        char c
        print "[[" in_String "]]\n"
        for (i=0; i<len; i++)
        {  c = in_String[i]
           print "\t" i "\t[" c "]\t" (intOf(c)) "\n"
        }
}
PrintString("Hello")


All this sort of thing has origin zero: positions in a string or Buffer, positions in an "array", positions in an "Array".

-Louie