Data Source widget filtering - part III

This is sort of a followup to Data Source Widget Filtering - part II

Now I’m trying to filter results in a data source widget where the target field contains a specific value rather than equals it.

The equals syntax I have used so far with success is:

<arg id="search"><FIELDNAME>=<VALUE></arg>

Since Karl mentioned in an earlier post that search in data source widgets is pretty much converted to SQL, I crossed my fingers and tried:

<arg id="search"><FIELDNAME> like "%<VALUE>%"</arg>

but that didn’t work.

So, is there way to do what I’m trying to do?

Hi G,

If it helps, I believe the data_source custom module uses different search/filtering logic behind the scenes depending on what type of data the source is coming from. That being said, it looks like in the code that I can see on our end, CSV, MySQL, Oracle, and XML versions all have some version of support for * as a wildcard (<arg id="search">*foobar*</arg>) – see if that may do the trick?

Karl

yes - that was it! Guess I should have thought of the ampersand but I was so in MySQL-land that it never occurred to me…

I used:

<arg id="search"><FIELDNAME>=*<VALUE>*</arg>

Thanks!

1 Like