NULLs are NULL. They are nothing. Like in a suspended state. Dust in the 
wind. Completely untraceable unless IS NULL or IS NOT NULL are specified as 
WHERE clauses.

Not True means False. 
Not False means True.

If you need to fetch False OR NULL records....

db(
     (db.t_tests.f_test_is_a_clone == False) | 
  (db.t_tests.f_test_is_a_clone == None)
).select()

or (hidden gem)

db(db.t_tests.f_test_is_a_clone.belongs((False, None), null=True)).select()

On Thursday, March 27, 2014 12:46:18 PM UTC+1, Avi A wrote:
>
> i checked all items as clones, then unchecked those i wanted,, and it's 
> all fine now.
> thanks.
>
> On Thursday, March 27, 2014 1:20:28 PM UTC+2, Mandar Vaze wrote:
>>
>> Which DB are you using ? The generated SQL seems correct (For MySQL - 
>> is_active is set to 'T' for True and 'F' for False) 
>>
>> Can you run the (modified, if needed) raw SQL query on the DB ? Just 
>> examine various values under the f_test_is_a_clone column.
>> That will give you idea as to what should be the "raw" SQL query - based 
>> on which you'll be able to figure out what you may be doing wrong in DAL 
>> query
>>
>> You can also try 
>>
>> (db.t_tests.f_test_is_a_clone != True)
>>
>> -Mandar
>>
>>
>> On Thursday, March 27, 2014 1:58:16 AM UTC+5:30, Avi A wrote:
>>>
>>> Now I use:
>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (db.t_tests
>>> .f_test_is_a_clone == False) ).select()
>>>
>>>
>>>
>>> and the list is still emply. 
>>>
>>> SELECT t_tests.id, t_tests.f_test_name, t_tests.f_test_project, t_tests.
>>> f_test_platform, t_tests.f_test_device, t_tests.f_test_milestone,t_tests
>>> .f_test_env, t_tests.f_test_description, t_tests.f_test_case_link,t_tests
>>> .f_test_is_a_clone, t_tests.is_active, t_tests.created_on, t_tests.
>>> created_by, t_tests.modified_on, t_tests.modified_by FROM t_tests WHERE 
>>> ((t_tests.created_by = 1) AND (t_tests.f_test_is_a_clone = 'F')); 
>>>
>>>
>>>
>>> thanks. 
>>>
>>>
>>>
>>> On Wednesday, March 26, 2014 8:53:10 PM UTC+2, Avi A wrote:
>>>>
>>>> Thanks you all and for the debugging tip. :)
>>>>
>>>> On Wednesday, March 26, 2014 7:57:28 PM UTC+2, Anthony wrote:
>>>>>
>>>>> In DAL queries, you must use &, |, ==, and ~ rather than "and", "or", 
>>>>> "is", and "not". This is because in Python, the former operators can be 
>>>>> overloaded (in the case of the DAL, via the Expression class) but the 
>>>>> latter cannot.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Tuesday, March 25, 2014 8:08:40 PM UTC-4, Avi A wrote:
>>>>>
>>>>>> Hi,
>>>>>> i have a table with a boolean field:
>>>>>>
>>>>>> Field('f_test_is_a_clone', type='boolean',
>>>>>>           label=T('Test is a clone')),
>>>>>>
>>>>>> And this is the query, where I don't want to return cloned tests:
>>>>>>
>>>>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db.
>>>>>> t_tests.f_test_is_a_clone)).select()
>>>>>>
>>>>>> but it returns empty list. 
>>>>>> What should i fix?
>>>>>> thanks.
>>>>>>
>>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to