In a Custom Device Report, what is the correct syntax to use to search for a 
substring within a larger string?  
That is, how do I find "/IT Operations"  in "/SW CAD, /IT Operations" ?

I have a custom device report mostly working.
My company uses Groups to organize devices according to Business Units.
Three example Business Units: IT Operations, IT Applications, SW CAD

The method "getDeviceGroupNames(self)" returns Groups information as a list.  
Since the Report needs a string (not a list), I followed this article "Creating 
Methods for Custom Reports"
http://www.zenoss.com/Members/cluther/creating-methods-for-custom-reports 
and  created the following Custom Method "getDeviceGroupNamesAsString"
with this code

Code:
return ','.join(context.getDeviceGroupNames())



This Method allows me to use the following Query in the report:

Code:
here.getDeviceGroupNamesAsString().startswith("/IT Operations")



That query works, but only displays devices where the string of Group Names is 
/IT Operations
or
/IT Operations, /SW CAD 
The query fails if the Group Names string is 
/SW CAD, /IT Operations 

I believe I need to incorporate a python re module into the query, and that's 
beyond my skill at present.  Am I looking at this the wrong way?

Here's a list of earlier forum posts I have reviewed and made use of:
() Reporting Question http://forums.zenoss.com/viewtopic.php?t=5887
() How to pull out OS/IpService for a custom report?   
http://forums.zenoss.com/viewtopic.php?p=29294
() syntax for query on custom report? 
http://forums.zenoss.com/viewtopic.php?t=6094

Any help would be appreciated.
Thanks,
David Sloboda




-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=30740#30740

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to