Jump to content
rtansey96

Query Logic (cm find) for Attributes Help

Recommended Posts

In order to filter out branches that have been merged and/or abandoned (like test branches), I was looking into attributes as they seemed like the easiest way to have a blanket identifier for this kind of flag.

I am able to easily add a "find branches where attribute='Closed' " to find the closed branches, but how can I do the inverse of this? I would like to have a filter that shows everything with an attribute != 'Closed".

I know I could add an attribute to everything, mark it as "1" and set "0" as the "hide" options, but that requires every branch to be updated and modified. Only on finished code reviews should an attribute be appended in order to keep the workflow easy.

Does anyone have any knowledge about Query statement logic and syntax? The documentation only shows "=" examples. Thank you!

Share this post


Link to post
Share on other sites

Also, if != does exist, but doesn't show branches because they simply don't have one assigned at all, is there a way to check if a branch has no attribute?

Share this post


Link to post
Share on other sites

Hi rtansey96,

I think your issue can be solved using the 'not' keyword. If you'd like to list all branches that don't have the 'Closed' attribute set (no matter what value), you can run:

cm find branches where not attribute = 'Closed'

The 'not' operand can be applied to any operation or statement inside the find query.

Is this what you were looking for? :)

 

Regards,

Miguel

Share this post


Link to post
Share on other sites

Yes! Thank you very much. This works like a charm. Is there any sort of documentation regarding these Querys? I'm unfamiliar if it is something Plastic has made in-house or if it something already out there. The only documentation I found on the website had few examples, but wasn't very robust. @mig

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×