{iw_sql_open data_source = "dbiDBC:teamsite" user_name = "*" password = "*" connection = "*"} {iw_sql_query connection='teamsite' result_set="eventList"> {iw_value name='$sql'/} {/iw_sql_query} {iw_if expr='! defined $eventList'} {iw_then} Exceptional Content Here {/iw_then} {/iw_if} {iw_else} {iw_sql_iterate var='events' result_set='eventList'} Normal Flow Here {/iw_sql_iterate} {/iw_else}{/iw_sql_open}
Here's the code:[...]Sorry for the brackets, it wasn't rendering without them.Indeed, I just want to test if eventList is undef..is the above correct?Running TS 6.5.0 SP 1 on UnixTHANKS in advance!matt
... <iw_if expr='scalar(@{$eventList} == 0)'>...
Greetings,I've finally returned to this project and want to put it to bed!!unfortunately: @{iw_if expr='scalar(@{$eventList} == 0)'} doesn't complile.nor does:<iw_if expr='scalar(@{$eventList}) == 0'>Sorry to be so perl clueless, but any hint as to what's going on here would be appreciated. I know what the code is attempting to do.. but can't quite figure out a fix.
if (1) { # bare "{" messes up iw_next ! my $iw_if = (scalar(@{$eventList}) == 0) ? 1 : 0;
After running the tpl with -ocode, I get the following error attached to the code we're working with above: if (1) { # bare "{" messes up iw_next ! my $iw_if = (scalar(@{$eventList}) == 0) ? 1 : 0;Any suggestions?
{iw_if expr='scalar(@{$eventList}) == 0'} {iw_then} content follows, like the below: {item} {title}There are no events this week{/title} {item} {/iw_then} {/iw_if}
Heh.. that part had been fixed..And how do you guys get lessthan greaterthan signs to show? When I put them inside of code tags, they don't show up... Here's the offending block again: {iw_if expr='scalar(@{$eventList}) == 0'} {iw_then} content follows, like the below: {item} {title}There are no events this week{/title} {item} {/iw_then} {/iw_if}
I've attached the offending tpl. Not sure what's malformed re: the above, no need to laugh at me though. Some segments have been deleted to protect the innocent. This TPL compiles correctly without the offending segment. Again, the goal of all this is to cover an exception period of time where my sql query returns no results (no concerts in the upcoming 7 days, specifically).Thanks in advance!
Referring to your post above, are you sure: my $eventList = (); is equivalent to...
After running the tpl with -ocode, I get the following error attached to the code we're working with above:if (1) { # bare "{" messes up iw_next !my $iw_if = (scalar(@{$eventList}) == 0) ? 1 : 0;
{iw_perl} my $size = scalar(@eventList);{/iw_perl}{iw_if expr='$size == 0'} blahblah{/iw_if}