Is adding rows to smart_group_queries to speed up dynamic criteria entry a bad idea?


  • I want to create a dynamic group that has the effect of:

    ... WHERE Bios.serial_number IN ("ABC","123","Foo","Bar");
    

    Dynamic Groups only allow for operators: =, !=,>,<,>=,<=,LIKE and NOT LIKE
    You can string them together with OR or AND, which means the query would look something like:

    ... WHERE Bios.serial_number Like 'ABC' OR Bios.serial_number Like '123'...
    

    With a long list of OR conditions.

    But the UI forces multiple clicks per OR condition.

    The problem is: what if I have like ~250 serials I want to include?

    This would mean ~250 rows, with each needing multiple clicks to fill out the criteria.

    With that being said, is it a bad idea to insert the criteria into the smart_group_queries table programmatically?

    Some things I've tried/Considered

    Things I've Tried/Considered Why I ruled them out
    Creating a static Group and programmatically adding memberships using SQL If a computer gets a new ID or is a computer that hasn't been added to TOEM yet, I want the group to dynamically update
    Entering dynamic criteria manually in the query builder Time Consuming, prone to human error, soul-sucking?
    Adding the IN operator manually in the operator field and a list in the value field of a row in smart_group_queries This didn't seem to work. I tried a few combinations of quotes, no quotes, etc in the value field. Plus the UI handler really doesn't like it.

    This leaves me with the remaining idea of adding the rows programmatically to smart_group_queries, but I wanted to see if anyone else had a better idea.

    TLDR: I wanna programatically add dynamic criteria to smart_group_queries, but am hesitant to since it sounds like a dumb idea and was wondering if anyone had a better idea.


  • There wouldn't be any way to do this currently. The next version will provide a way to write your own SQL queries.


  • @theopenem_admin Wow, thank you for the quick response! The ability to write your own SQL query would be super helpful! I appreciate the fact that you're still adding features and responding to community posts. Looking forward to 1.5.7!