I had a use case where I needed an entity field condition to check on multiple values.

So if field_a matched data 'x' 'y' or 'z', the context would activate. I could do this by creating multiple contexts, but that would've become a mess.
For now I patched the module by delimiting the entered value on a comma and looping the results.

Maybe it would be better giving this as an extra 'Field status' option, but this met my needs: http://cl.ly/image/1a2x3e2c452z

Comments

mavimo’s picture

Thanks for patch.

There are some issue on coding standard and will be usefull to trim data (eg: "1, 2, 3" generate '1', ' 2', ' 3' and can genrate possibile error on comparison). Will be usefull to have a separate flag to indicate when a field is a multiple element or just a single element (eg, if a field is a testfield, text having ',' can genrate error).

mavimo’s picture

Status: Needs review » Needs work
rodlangh’s picture

Thanks for the feedback, I'll try to fix the patch later this week.

Concerning the separate flag: Would it be usefull if an extra input field was provided where users could provide their delimiter? And when no option would be given, the function would only try to match a single value.

mavimo’s picture

@Rodlangh: Yes, can be a solution. An accurate description will be required to make possible for user undestand the scope of field. Thanks for your work :)

rodlangh’s picture

Status: Needs work » Needs review
StatusFileSize
new2.35 KB

Didn't make it last week, but here's a new version of the patch nonetheless.

Added delimiter field with description, trimmed the condition values while looping and hopefully paid more attention to the coding standards.

hass’s picture

mavimo’s picture

Assigned: Unassigned » mavimo
mavimo’s picture

@Rodlangh: I added a first step of testsuite in project, can you re-roll your patch and add test?

Thanks!!

rodlangh’s picture

I'll look into it. Will take some time though, current deadlines got a bit more priority.

stephesk8s’s picture

Issue summary: View changes

Patch worked well for me. A big help. Thank you.

delacosta456’s picture

hi
please is it possible to extend this patch for more option like :

Not equal to
Less than
greater than
etcc...

thanks