Post

2 followers Follow
1
Avatar

How does CSDL deal with array targets?

I am trying to write CSDL which uses the twitter.mentions target, and am very confused. The examples given in the documentation say that the right way to do this is:

twitter.mentions == "@SomeHandle"

for single handles, and:

twitter.mentions in "@SomeHandle,@AnotherHandle"

if I wish to search for multiple handles.

Which confuses me on two fronts:
1) Why can't I use the 'in' operator for both cases?

2) twitter.mentions is an array, and the right side of both those expressions is a string; how can an array be equal to a string? Is there some sort of (completely undocumented, as far as I can find) implicit looping going on?

John Maxwell

Official comment

Avatar
  1. You can! The in operator is fine for both, it's just that == looks for an exact match where as 'in' takes a comma separated list.
  2. For array(string) datatypes, the platform compares each element of the array to the list provided. So for twitter.mentions in "somehandle,anotherhandle", the platform will compare each handle in the mentions array to the value(s) provided. Also you don't need the @ symbol for that target.
jbreucop
Comment actions Permalink

Please sign in to leave a comment.

4 comments

0
Avatar

Great! How about adding something about that to your documentation?
Another question: I get that I can omit the @; am I required to omit the @?

John Maxwell 0 votes
Comment actions Permalink
1
Avatar

I just checked. You are required to not put the @ symbol since the field is looking for exact username matches.
In case you're curious/would like to check yourself, I used this csdl to verify: https://datasift.com/essence/rljxiz
All responses that come through are tagged as "without". If the @ symbol could work, "with at" would have tagged the interactions.

jbreucop 1 vote
Comment actions Permalink
0
Avatar

Cool. Thanks again, and again, your doc needs work; something like "You must omit the @ sign" would be more appropriate than the current "You don't have to include the @ sign".

John Maxwell 0 votes
Comment actions Permalink