CMS API : filtering type instance query by multivalued attribute
Hello to all,
I am using the CMS api /cms/instances/file/{type}?filter={attribute}={value}
I need help finding the correct syntax to use for the filter when the attribute is multivalued , in my case the attribute is "receiver_s_email" and is an array - THANKS
Best Answer
-
@Med_2024 for multi value / repeating attributes you can use the syntax as : {attribute} contains ('value1', 'value2').
Example: https://na-1-dev.api.opentext.com/cms/instances/object/cmv_mvtf?filter=mytags contains ('Blue 1', 'mix')This will filter instances that have the both values 'Blue 1' and 'mix' in the mytags attribute.
1
Answers
-
@Med_2024 for multi value / repeating attributes you can use the syntax as : {attribute} contains ('value1', 'value2').
Example: https://na-1-dev.api.opentext.com/cms/instances/object/cmv_mvtf?filter=mytags contains ('Blue 1', 'mix')This will filter instances that have the both values 'Blue 1' and 'mix' in the mytags attribute.
1 -
Hello @jpluimers , I thought filtering with contains solved the issue , but not quite well :because what I want is to filter the instances that contains or includes the searched word
Example: https://na-1-dev.api.opentext.com/cms/instances/object/cmv_mvtf?filter=mytags contains ('Blue 1',)
should return all instances that includes 'Blue1' like : ('Blue 1', 'mix') ('Blue 1', 'Blue 2') ('Blue 1', 'Blue 2', mix) …
current behaviour of the filter is returning instances with exact match only !!
0 -
Here are some more examples to show how the filter behaves with contains.
My test set is:
"mytags": [ "Green 1", "Green 3", "mix" ],
"mytags": [ "MV1", "MV3" ],
"mytags": [ "mix", "Pineapple" ],
"mytags": [ "Blue 1", "Blue 2", "mix" ],
"mytags": [ "Green 1", "Blue 1", "mix" ],Using filter: ?filter=mytags contains ("Blue 1")
Gives me:
"mytags": [ "Blue 1", "Blue 2", "mix" ],
"mytags": [ "Green 1", "Blue 1", "mix" ],Here every entry that has a tag "Blue 1" is returned.
Using filter: ?filter=mytags contains ("Blue 1", "mix")
Gives me:
"mytags": [ "Blue 1", "Blue 2", "mix" ],Here the contains wants to match all tags given in the contains set and will match only one object.
Using filter: ?filter=mytags contains ('Blue 1') or mytags contains ('Blue 2')
Gives me:
"mytags": [ "mix", "Pineapple" ],
"mytags": [ "Blue 1", "Blue 2", "mix" ],
"mytags": [ "Green 1", "Blue 1", "mix" ],This is an normal OR.
Using filter: ?filter=mytags contains ('Blue 1') and mytags contains ('mix')
Gives me:
"mytags": [ "Blue 1", "Blue 2", "mix" ],
"mytags": [ "Green 1", "Blue 1", "mix" ],This is a normal AND.
Hope this helps to solve your filter.
1
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 151 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories