This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Adding multiple filters to the group member definition ?

We are creating Groups using REST Api and Powershell. The groups are getting created but there is a problem.@@

How can i include 2 conditions in a single dynamic query. I know that i can include multiple dynamic queries, but when i include multiple queries they become OR condition.

Like when i create member as this snippet

$members = @(

                    @{ Name = "$city City Node"; Definition = "filter:/Orion.Nodes[CustomProperties.City='Austin']" },

                    @{ Name = "$city Node Dependency"; Definition = "filter:/Orion.Nodes[CustomProperties.Dependency_BreakDown='Edge_Parent']" }                   

    )

It will create two different dynamic queries.

But i want to create a single dynamic query such as the City for the Node must be Austin AND Dependency_BreakDown must be Edge_Parent

Any help would be appreciated

tdannermesverrum

Attaching the working script for people like me who are searching for solutions

Bulk_Groupcreation.ps1
  • The best to learn how to form you filters is to create one by hand in the GUI and then look it up in the tables and see how it shows up there, in this case the syntax is something like

    @{ Name = "$city City Node"; Definition = "filter:/Orion.Nodes[CustomProperties.City='Austin' AND Dependency_BreakDown='Edge_Parent']" }

    but thats from memory off the top of my head, check by creating an example manually in your system to make sure it's correct.

  • Hello Mesverrum,

    what you mentioned is right with just a slight change, it will come as CustomProperties.Dependency_BreakDown

    @{ Name = "$city City Node"; Definition = "filter:/Orion.Nodes[CustomProperties.City='Austin' AND CustomProperties.Dependency_BreakDown='Edge_Parent']" }

    I created the groups and it got created just fine.

    Thanks for your help

  • Hello mesverrum

    I Created the dynamic group using the AND condition , the groups got created perfectly. But a problem arised susch as there are no nodes added in the group.

    When i tried previewing the dynamic query which got created using the api the nodes are showing under the query results. But when i click on groups, under Group members it is showing You currently have not configured items. To display add items to this group.

    Any help would be greatly appreciated.

  • There is a lag time between changes to dynamic group memberships and the group actually checking if there is anyone new.  Editing the membership in the GUI forces an update immediately, otherwise you can just wait and it will usually catch up later.

  •  

    i need help.I have 2019.4 , Created new 500 + groups with dynamic query using Rest API. groups and dynamic query are created but dynamic query not filtering the correct values. as per filter put in query.Please check below 2 screenshots where yellow mark dynamic query is showing in warning status and 2nd screenshot I manually click on edit dynamic tab and saved , not changed any thing in query. After saved it updated and showing in green which is latest result of query. these query need to be updated automatically. what should i do ?

    used below 

    child=sw.invoke('Orion.Container', 'CreateContainerWithParent', ids, concat[j],'Core',60,
    0,'',True, [{'Name':subnets[j],'Definition':"filter:/Orion.Nodes[StartsWith(IP_Address,"+dynamic_query_ips[j]+")]"}])

    attachments.zip
  • I'd pick one of them, check the database before you do the save and then check it after to see if anything changes.  I have noticed from past experience that it is extremely particular about case sensitivity and white spaces so I suspect that what happens is that the script you have is making something that is ALMOST right.  When you hit the save button in the GUI the back end of the application is fixing the formatting to match up to the way they want it and your filter is able to take effect.  Thats my best guess though.

  • Could you tell me please, where I can find dynamic queries definitions in the Orion db? What table shell I check?