I tried virtual field but can not use it as request args to select the 
records
They do not appear in the list table fields.

I got a ticket using the computed field example 

Field('article_link', lambda r: r.article_title.replace(' ', '-'))

or also

Field('article_link', lambda r: r['article_title'].replace(' ', '-'))


On Wednesday, April 18, 2018 at 1:28:51 PM UTC, Anthony wrote:
>
> You probably want a computed field 
> <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Computed-fields>
> .
>
> Field('article_link', lambda r: r.article_title.replace(' ', '-'))
>
> Alternatively, to avoid storing redundant data in the database, you can 
> instead use a virtual field 
> <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#New-style-virtual-fields>
>  (that 
> will add a little overhead at runtime, as the links will be created from 
> the titles when you select rows from the database).
>
> Anthony
>
> On Wednesday, April 18, 2018 at 6:58:47 AM UTC-4, dirman wrote:
>>
>> How can i automatically repeat a field text into another field with 
>> hyphens to replace spaces before record insertion
>>
>> I want to insert 'High Temperature In City' in the article_title and to 
>> be repeated in the article_link with hyphens
>>
>> db.define_table('articles',
>> Field('article_title', 'string'),
>> Field('article_link', 'string'))
>>
>>
>> Example:
>> http://domain.com/articles/high-temperature-in-city/
>>
>

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