sorry for the code] ] > < iw_iterate var="currentFile" list="dcr.files" > < ! [ CDATA [hope this works...
In my data capture, I can add files to my formIn my template I iterate these filesAnd I'd like to know if there is files in my DCR... If not I don't want to iterate.Hope this helps... Again, apologize for this newbies question...Thanks againOlivier
In my data capture, I can add files to my formIn my template I iterate these files[HTML]]]><br><br><li><a href="../.."><br></a></li><br>[/HTML]<br><br>And I'd like to know if there is files in my DCR... If not I don't want to iterate.<br><br>Hope this helps... Again, apologize for this newbies question...<br>Thanks again<br>Olivier</TD></TR></TABLE></BLOCKQUOTE>First, I'd recommend getting rid of all that CDATA baggage - you only need that if your PT uses <pre><<x>iw_pt name="..."><br> ...<br><<x>/iw_pt></pre>If you use that element as an <i>empty</i> element <pre><<x>iw_pt name="..."<font color=red><b>/</b></font>></pre>or leave it out altogether - you don't need the CDATA elements and it makes it much easier to read/write/maintain the PT code.<br><br>Secondly - If there are no elements within the container/replicant being processed then it should be a no-op and you shouldn't worry about the iteration. From a Perl perspective it's kind of like this:<pre>my @empty_list;<br>foreach my $entry (@empty_list){<br> print "Hello World\n";<br>}</pre>If there's nothing in the array (<p><span style="font-family: Verdana;">@empty_list</span></p>) then the string "Hello World\n" will not be printed - not even once. Now you could write the above code to look like this:<pre>my @empty_list;<br>foreach my $entry (@empty_list){<br> if ($entry !~ /^\s*$/){<br> print "Hello World\n";<br> }<br>}</pre>but that only makes sense if the array contains <i>empty elements</i> as opposed to being an empty list - i.e.:<pre>my @empty_list = ("Hello", "", "World");</pre> in which you don't want the <i>empty string</i> in the middle to cause an (extra) iteration to occur.
I need to check if my list of link is empty because I do :-if list is not empty--image number1---iterate my list-----first file-----second file-----...---stop iterate--image number2-end ifFor the moment, I iterate my list and nothing is printed if there is no link in my list...except my image number1 and image number2 !thanks again for your help
<iw_if expr='(iwpt_dcr_list("dcr.files") > 0)'> <iw_then> <img src="..."/> <iw_iterate ...> ... </iw_iterate> <img src="..."/> </iw_then><iw_if>
[HTML] ...[/HTML]iwpt_dcr_list("dcr.files") always = 1 ... ??--- probably because in my DTC I have at least 1 file input (even if I leave it blank)So, I have to check if --iwpt_dcr_list("dcr.files") > 0-- and if the first link is not blank...How can I do this ?your answer will probably close the thread :-)thanks again for your help
<iw_if expr='(iwpt_dcr_list("dcr.files") > 0 && iwpt_dcr_value("dcr.files[0].file") ne q{})'> <iw_then> ... </iw_then><iw_if>