跳至内容
菜单
此问题已终结
3 回复
10247 查看

Hello!!!!

DOes anyone know how to separate two words with comma?

I have a name, surname as stucture.

But, i want to get the name in a column and the surname in the other column.

I am working with qweb (XML)

Can anyone help me please.

Best regards.

形象
丢弃
最佳答案

Try  split  like "'prakash,kumar'.split(',')":


<t t-set="my_name" t-value="'prakash,kumar'.split(',')"/>
<t t-esc="my_name[0]"/>
形象
丢弃
编写者

Thanks a lot my friend ;)

最佳答案

Just in addition i would like to share my scenario solved with @Prakash Kumar hint.

My call at 'customer.comment' was returning a string "car, roads, breaks, lights, tires, gears"... The magic split method "inherited" from web.assets_backend convert it to an Array / List and our pretty good <t t-foreach /> works properly.

<t t-if="customer.comment"> <!-- This means, if there are some value at this call -->
    <t t-set='prod_serv' t-value="customer.comment.split(',')"/>
        <t t-foreach='prod_serv' t-as='ps'>
            <li><t t-esc='ps'/></li>
        </t>
</t>
形象
丢弃
相关帖文 回复 查看 活动
0
4月 20
2595
5
11月 24
46273
5
8月 20
15302
1
9月 17
4408
3
5月 17
4637