- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2014 01:34 PM
If I wanted to set a reference qualifier to something like:
(name ==='a' and class ==='b') or (name ==='c' and (class ==='d' or class ==='e'))
or
name === 'a' and (class === u_something.class or class === u_somethingelse.class)
Is that possible as an encoded query, or would I need to call an include script to put those results into a list?
Thanks,
-Stephen
--------------------------------
Note that the accepted answer is not the correct answer in this case. I've added the correct answer as a reply at the bottom.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2014 02:21 PM
There is no equivalent. What is your business requirement? Perhaps we can brainstorm a solution outside of the qualifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2014 02:21 PM
There is no equivalent. What is your business requirement? Perhaps we can brainstorm a solution outside of the qualifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2014 09:39 AM
The business requirement is a non-issue. I've solved in another fashion(using "IN"), and if I needed something more complex, I could solve with a script include. I was just hoping the encoded query spec had something I didn't know about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2014 12:18 PM
Alrighty, now that I have the correct answer.. I thought I'd share it with the community.
This IS possible with an encoded query:
The query from my original question:
name==a && (sys_class_name==b || sys_class_name==c || sys_attrib_name==d)
Can be written as:
'name=a^sys_class_name=b^ORsys_class_name=c^ORsys_class_name=d'
This works because all of the "^OR" operations will be evaluated together under the prior condition. (name=a)
If however, you want to evaluate an "OR" operation independent of the prior statement, you'll need to add "^NQ"(new query) to the operation. Such as this:
'name=a^sys_class_name=b^ORsys_class_name=c^NQname=b^sys_class_name=d^ORsys_class_name=e'
Which will be evaluated like this:
(name==a && (sys_class_name==b || sys_class_name==c)) || (name==b && (sys_class_name==d ||sys_class_name==e))
However, I'm still not aware of a means to do second level nesting, such as:
(name==a && (sys_class_name==b || (sys_class_name==c || somevalue==2)))
The workaround would be to split this into two with the same initial comparison:
'name=a^sys_class_name=b^NQname=a^sys_class_name=c^ORsomevalue=2'
The workaround seems a little redundant, but it works just fine. If you have a more elegant solution, feel free to add it on.
**Not looking for tips about using the UI to build the query for you, this thread is about understanding how encoded queries are evaluated.
Thanks,
-Stephen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2014 12:29 PM
the easiest way to make an encoded query is to bring up a list view of your table...
now use the condition builder in the filter to create your condition... so for your example i brought up the incident table and queried for caller was mosterlink and priority was 1... or caller was randrews and assignment group was sds or process automation...
now that i have my query right in a list view.. right click the LAST bread crumb and select copy query...
caller_id=647e57507bb300002e3ddb30aa4d4d16^priorityIN1,2^NQcaller_id=f27e57107bb300002e3ddb30aa4d4dfb^assignment_group=a20fb74c0a0a3d2801b401ac1df9433e^ORassignment_group=9fc174ca21652840fff5c2c4b3587caf
put that entire string in your encoded query and it will work like a champ