Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5140 Zobrazení

Hi,

I have this bit of code:

%for analysis in inv.x_tcc_analysis_ids :   
            <td width="20%" style="text-align:left;border:1px solid #555;border-left:none;padding-top: 8px;">
              <table width="100%" cellspacing="0" cellpadding="10px">
                  <tbody>
                    <tr><td style="text-align:center;border:none;border-bottom:1px solid #555;;">Year ${ analysis.x_year or '' |entity }</td></tr>
                    <tr><td style="text-align:right;border:none;border-bottom:1px dashed #555;">N ${ formatLang(analysis.x_total_income) or ''|entity }</td></tr>
                    <tr><td style="text-align:right;border:none;border-bottom:1px dashed #555;">N ${ formatLang(analysis.x_tax_paid) or '' |entity }</td></tr>
                    <tr><td style="text-align:right;border:none;border-bottom:1px dashed #555;">${ analysis.x_gitr_number or '' |entity }</td></tr>
                    <tr><td style="text-align:right;border:none;border-bottom:1px dashed #555;">${ analysis.x_gitr_date or '' |entity }</td></tr>
                  </tbody>
              </table>
            </td>      
        %endfor

I'd like to be able to limit the number of iterations to 3. I've tried using the range function but no joy so far.

Any help will be hugely appreciated. Thanks

Avatar
Zrušit
Nejlepší odpověď

use this:

<% i = 0 %>
%for analysis in inv.x_tcc_analysis_ids : 
    <% i+=1 %>
    %if i == 4:
        break
    %endif
    ...
    ...
Avatar
Zrušit
Autor

Worked nicely. Thank you.

sounds good..:)

Related Posts Odpovědi Zobrazení Aktivita
4
zář 16
9087
1
led 16
4247
0
bře 15
4370
3
bře 15
11285
2
dub 24
2206