Skip to Content
Menu
This question has been flagged
2 Replies
5193 Views

I need to create a user defined filter like this:

if (field1 = 10 and field2 = 12) or (field3 = 13 and field4 = 13) or (field5 = 15 and field6 = 16)


In Settings->User Interface->User-defined Filters, I've created a filter like this:

['|', '|', ['&', ['field1', '=', 10], ['field2', '=', 12]], ['&', ['field2', '=', 13], ['field4', '=', 14]], ['&', ['field5', '=', 15], ['field6', '=', 16]]]


But it's giving error on client browser:

ValueError: Invalid leaf ['&', ['field1', '=', 10], ['field2', '=', 12]]


What is the correct way to do it?

Avatar
Discard
Best Answer

You're using too much parentheses for polish notation...

you should use something like:

['|', '|', '&', ('field1', '=', 10), ('field2', '=', 12),'&', ('field2', '=', 13), ('field4', '=', 14), '&', ('field5', '=', 15), ('field6', '=', 16)]
Avatar
Discard
Best Answer

Hello Carlos,


Try this :-

['|', '|', [('field1', '=', 10), ('field2', '=', 12)], [('field3', '=', 13), ('field4', '=', 13)], [('field5', '=', 15), ('field6', '=', 16)]]


Hope it will help you


Thanks,


Avatar
Discard
Author

it doesn't work this way, Temur gave correct answer Thanks any way