Filter based on Object Identifiers

Is it possible to perform filtering based on the object identifiers. Consider the case of list of object identifiers, i;ve filter the objects only for those identifiers
Lion29 - Mon Feb 08 02:16:49 EST 2010

Re: Filter based on Object Identifiers
Mathias Mamsch - Mon Feb 08 05:34:34 EST 2010

I made a handy script for that once, where you will get an edit window and you can paste the identifiers you are looking for and it will filter the ids for you. It is not robust when it tries to ignore the module prefix (so don't use prefixes that end with a number) :-) Have phun with it,

Regards, Mathias
 

//
 
/*

*/
 
DB gui 
DBE ed 
 
gui = centered "Filter IDs"
ed = text (gui, "Filter IDs", "", 400, false)
block gui
 
string s = get(ed)
 
Regexp re = regexp ("[0-9]+")
 
string n 
int id 
 
if ! re s then print "Nichts gefunden!"
 
Object o 
 
for o in entire current Module do reject o
 
while (re s) {
    n = s[start 0:end 0]        
        s = s[end 0+1:]
        
        id = intOf realOf n
        
        // print "Nummer:" n "\n" "Rest:" s "\n"
        
        o = object id
        
        if (!null o) {
                accept o 
                // print "Accepting Object " id "\n"
        } else { 
                print "Object " id " konnte nicht gefunden werden!\n" 
        }
}
 
filtering on

Re: Filter based on Object Identifiers
Lion29 - Mon Feb 08 07:10:54 EST 2010

Mathias Mamsch - Mon Feb 08 05:34:34 EST 2010

I made a handy script for that once, where you will get an edit window and you can paste the identifiers you are looking for and it will filter the ids for you. It is not robust when it tries to ignore the module prefix (so don't use prefixes that end with a number) :-) Have phun with it,

Regards, Mathias
 

//
 
/*

*/
 
DB gui 
DBE ed 
 
gui = centered "Filter IDs"
ed = text (gui, "Filter IDs", "", 400, false)
block gui
 
string s = get(ed)
 
Regexp re = regexp ("[0-9]+")
 
string n 
int id 
 
if ! re s then print "Nichts gefunden!"
 
Object o 
 
for o in entire current Module do reject o
 
while (re s) {
    n = s[start 0:end 0]        
        s = s[end 0+1:]
        
        id = intOf realOf n
        
        // print "Nummer:" n "\n" "Rest:" s "\n"
        
        o = object id
        
        if (!null o) {
                accept o 
                // print "Accepting Object " id "\n"
        } else { 
                print "Object " id " konnte nicht gefunden werden!\n" 
        }
}
 
filtering on

I'm not able to filter tat out.. is there any corrections to be made in the script???
it does not throw any error. unable to track what is the result of the regular expression output. I'm not sure what will be the output of the regular expression. :-(

Re: Filter based on Object Identifiers
jsarkic - Mon Feb 08 07:25:00 EST 2010

Lion29 - Mon Feb 08 07:10:54 EST 2010
I'm not able to filter tat out.. is there any corrections to be made in the script???
it does not throw any error. unable to track what is the result of the regular expression output. I'm not sure what will be the output of the regular expression. :-(

Instead of using the "Object Identifier", use the "Absolute Number". "Absolute Number" is an attribute that you can apply standard filters to. In my experience, it is best to keep your coding to an absolute minimum, thus reducing your maintenance. By using the "Absolute Number" attribute, you do not have to worry about writing regular expressions to remove the prefix.

Re: Filter based on Object Identifiers
Lion29 - Mon Feb 08 23:46:24 EST 2010

jsarkic - Mon Feb 08 07:25:00 EST 2010
Instead of using the "Object Identifier", use the "Absolute Number". "Absolute Number" is an attribute that you can apply standard filters to. In my experience, it is best to keep your coding to an absolute minimum, thus reducing your maintenance. By using the "Absolute Number" attribute, you do not have to worry about writing regular expressions to remove the prefix.

yup.... seems goood anything is okay for me..
my objective is to filter based on identifiers/abs no... :-)