Post

2 followers Follow
0
Avatar

Query Multi Picklist Field

Hi,

I'm trying to query a multi picklist field where it contains one of the possible values of the picklist. However, if I use something like this, I get no results when there is more than one value set for a certain entity:

        <Query xmlns="http://clarizen.com/api">

            <queryExpression xmlns:q1="http://clarizen.com/api/queries" xsi:type="q1:EntityQuery">

                q1:TypeNameIssue/q1:TypeName

                <q1:Where xsi:type="q1:Compare">

                    <q1:LeftExpression xsi:type="q1:FieldExpression">

                        q1:FieldNameC_TRCategory/q1:FieldName

                    /q1:LeftExpression

                    q1:OperatorEqual/q1:Operator

                    <q1:RightExpression xsi:type="q1:ConstantExpression">

                        <q1:Value xsi:type="EntityId">

                            <TypeName>C_CaseTRCategory</TypeName>

                            <Value>Docs TR</Value>

                        /q1:Value

                    /q1:RightExpression

                /q1:Where

            </queryExpression>

        </Query>

So if my entity has in that field, let's say, "Docs TR; Audio TR", then it is not returned in the query. I see this is somehow possible as the Excel plugin allows that (I can choose "One of" and then "Docs TR" and it works). How can I build my query for this?

Thanks.

 

Fernando Borrego Polo Answered

Please sign in to leave a comment.

5 comments

0
Avatar

Hi Fernando,

Just use the In operator instead of Equal. No other change is required.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Hi again,

How can this be achieved using the REST API with CZQL? I'm trying with something like:

SELECT DisplayName FROM User WHERE C_MyCustomField IN ('MyMultiPicklistValue')

However, it raises an error. I tried several combinations of the query above with no luck...

 
Fernando Borrego Polo 0 votes
Comment actions Permalink
0
Avatar

Hi Fernando,

Do you have some more information about the error? Like the error message and the Ref id? 

Thanks,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Sure,

This is the exact query I'm trying:

{
q: "SELECT DisplayName, C_EAUserType, C_TranslationVendorType FROM User WHERE C_EAUserType IN ('Translation Vendor')"
}

And this is the error I get:

{
"errorCode": "Internal",
"message": "An internal error has occurred, the error was logged and will be examined.",
"referenceId": "14pOGhs9USgCWDIN1HXBnd"
}

 

Thanks.

Fernando Borrego Polo 0 votes
Comment actions Permalink