Hi Antony! This made too many things clear to me.
I got the point about "represent" function, but i guess the 
DIV(db...represent(...)) must be at a view file... and what about appadmin?

Trying to get the fields value through appadmin, I got the error "*sequence 
item 0: expected string, long found*"
My question is: Is there any thing I must do in models to not get this 
error in appadmin?

Cheers


Em quarta-feira, 17 de abril de 2013 00h33min13s UTC-3, Anthony escreveu:
>
> In the database, the value is stored as a string with the individual 
> values separated by pipe characters (i.e., "|a|b|"). However, when you 
> select from the DB using the DAL, the value gets converted to a list. 
> list:string fields get a default "represent" attribute that displays the 
> values as a comma-separated list in grids, etc., but you have to do it 
> yourself or explicitly call the "represent" function in other contexts:
>
> DIV(', '.join(row.test))
>
> or
>
> DIV(db.test.test.represent(row.test))
>
> Anthony
>
> On Tuesday, April 16, 2013 10:37:20 PM UTC-4, 黄祥 wrote:
>>
>> hi folks,
>>
>> is it possible to change list:string type field output format?
>>
>> e.g.
>> *in grid output : a, b*
>> *in shell output :  |a|b|*
>> >>> print db(db.test.test.contains('b')).select()
>> test.id,test.test
>> 1,|a|b|
>> *in view using query output : ab*
>> {{for i, row in enumerate(rows):}}
>>     {{=DIV(row.test)}}
>> {{pass}}
>> *in view using query output : ['a', 'b']*
>> {{for i, row in enumerate(rows):}}
>>     {{=DIV(str(row.test))}}
>> {{pass}}
>>
>> i want to have the output format for list:string type field in view : *a, 
>> b* or *a; b* instead of ab. did anyone know how to produce the output 
>> like that in web2py?
>>
>> thank you very much in advance
>>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to