Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
10516 Vizualizări

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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


<t t-set="my_name" t-value="'prakash,kumar'.split(',')"/>
<t t-esc="my_name[0]"/>
Imagine profil
Abandonează
Autor

Thanks a lot my friend ;)

Cel mai bun răspuns

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>
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
apr. 20
2839
5
nov. 24
46836
5
aug. 20
15561
1
sept. 17
4636
3
mai 17
4844