Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
6090 Tampilan

-  I want to skip the current iteration of the loop with continue in XML foreach ?

Avatar
Buang
Jawaban Terbai

Mostafa,

I don't think there is way to skip the loop, alternatively what u can do is, keep "if condition" to do your operation if particular condition matches, for eg:

to print div if your boolean value is true and skip if false, you can use:

<t t-foreach="<list_of_obj>" t-as="obj">

     <t t-if="obj.<bool_field>" ><!-- checking if field is True *-->

         <div>  Created when field is True</div>

     </t>

     <!-- No div will be created in 'false' case -->

</t>


Hope it helps!!

Avatar
Buang
Penulis

Dear Pawan.

I find a way out by setting flags using t-set tag and t-value

Thank you for your support !

Post Terkait Replies Tampilan Aktivitas
2
Agu 23
12813
1
Mar 25
1244
0
Nov 24
1456
0
Jun 24
1526
1
Jun 24
2021