Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
10530 Vues

Hi guys,

I have 5 search criteria:

A, B, C, D, E

I whant to search (and i have tried diferent options) like in sql:  select id from obj_obj where A= 2 and B=3 and C=4 and (D=5 or E=6)

Basic idea is:

  •  when D is False :
    • than look for E = 6
  • or when E is False:
    • then look for D=5

Numbers are just for example.

I read some documentation and googling but without real success. I tried [('A','=', 2),('B','=', 3),('C','=', 4),'|',('D','=', 5),('E','=', 6)] but the solution is not working. if i try to add () like: [('A','=', 2),('B','=', 3),('C','=', 4),('|',('D','=', 5),('E','=', 6))] i receive and error: ValueError: Invalid term...

Can you please help?

Many thanks!

Avatar
Ignorer
Auteur

'=' updated. I missed when i placed the question. Sorry.

Meilleure réponse

You have to put equal to D and E: [('A','=', 2),('B','=', 3),('C','=', 4),'|',('D','=', 5),('E','=', 6)] instead of [('A','=', 2),('B','=', 3),('C','=', 4),'|',('D','', 5),('E','', 6)].

 

Can you post the exact error?

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
sept. 23
34457
0
févr. 17
5054
3
mai 25
2606
0
mai 25
161
2
mars 24
1322