[dancer-users] iterate list of hash
Tonton
to.tonton at gmail.com
Tue Apr 22 14:57:37 BST 2014
hello
i use session for save somme data like this
foreach my $NumParc ( @NumParc ) {
my $parc = database('toto')->quick_select('Parc',
{ NumParc => $NumParc });
$Stock->{$NumParc} = ( $NumParc => { CodeArticle
=> $parc->{CodeArticle},
NumParc => $parc->{NumParc},
NumSerie => $parc->{NumSerie},
NumContrat => $parc->{NumContrat}
} );
session 'Stock' => $NewStock;
but is a bit complex in the template for seleting my fial values
the only things i can do is likke this
[% FOREACH NumParc IN stack.keys.sort %]
<tr>
[% FOREACH item IN stack.$NumParc.values %]
<td class="numcontrat">[% item %]</td>
[% END %]
[% END %]
so i can not use item.keys to chosse my value like i hope
[% FOREACH NumParc IN stack.keys.sort %]
<tr>
[% FOREACH item IN stack.$NumParc.values %]
<td class="numcontrat">[% item %]</td>
<td class="numserie">[% item %]</td>
<td class="numParc">[% item %]</td>
[% END %]
[% END %]
this is the json session file for stock
-
- "Stock": {
- "768572": {
- "NumParc": "768572",
- "NumContrat": "zzzzzzzzzzzzz",
- "NumSerie": null,
- "CodeArticle": "SZZZZZtttttt"
},
- "768573": {
- "NumParc": "768573",
- "NumContrat": "30912045",
- "NumSerie": null,
- "CodeArticle": "INST "
},
- "768571": {
- "NumParc": "768571",
- "NumContrat": "12045",
- "NumSerie": "1314ffffff374798",
- "CodeArticle": "250efg"
}
},
the paste add bullet
if someone may explain me a little where i am doing wrong ?
Regards
T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20140422/3afdf292/attachment.html>
More information about the dancer-users
mailing list