Excellent, the None value was indeed the problem, so i just gave a default 
string value in the table definition as *Field('search_term', 'string', 
default='')* and now it works. Thanks a lot.

On Monday, September 19, 2016 at 4:59:00 AM UTC+2, Massimo Di Pierro wrote:
>
> This works for me, I just tried:
>
> >>> db.define_table('rated_items',
>
>     Field('search_term','string'),
>
>     )
>
>
> >>> k = db.rated_items.insert(search_term='a')
>
> >>> db(db.rated_items.id
> ==k).update(search_term=db.rated_items.search_term+'b')
>
> >>> print db.rated_items[k]
>
> <Row {'search_term': 'ab', 'id': 1L}>
>
>
> you probably have None into the search_term field and it cannot be 
> concatenated with string.
>
> On Friday, 16 September 2016 05:44:36 UTC-5, Meinolf wrote:
>>
>> I had tried that and tried it just now but still gives a None value in 
>> the rated_items.search_term field. maybe it's got to do with the table def; 
>> my table definition is as follows:
>>
>> db.define_table('rated_items',
>>     Field('search_term','string'),
>>     Field('user_id', 'reference auth_user', default=auth.user and 
>> auth.user.id),
>>     Field('item_id', 'integer'),
>>     Field('clicks', 'integer', default=0),
>>     migrate=True,
>>     )
>>
>> On Friday, September 16, 2016 at 12:00:09 AM UTC+2, Meinolf wrote:
>>>
>>> Hi there
>>>
>>> So far i only know how to update a record by replacing the old field 
>>> value with the new value. Suppose i want to append the search_term string 
>>> value the corresponding text field so that both values are stored, how can 
>>> i do that in this code:
>>>
>>> myrow = db((db.rated_items.user_id==auth.user.id) & 
>>>  
>>> (db.rated_items.item_id==request.args(0))).update(search_term=str(request.vars.search_term)
>>>
>>> Would appreciate any help!!
>>>
>>

-- 
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