[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] How to use 'if' to compare item-field inside an item-list?
On Tue, Jun 05, 2001 at 10:40:48AM +0100, Matt Flaherty wrote:
> > Use [if-item-field dl_type] instead of [if item-field dl_type], that extra
> > dash is important.
>
> Thanks Jason. Unfortunately, I tried that and it didn't work. The docs say
> the [if-item-field] is a simple test of whether or not the field is empty.
Ahh, I see, I misunderstood, using a scratch var or [data] would be options,
you could also use the 'explicit' form:
[if explicit]
[condition]
'[item-field dl_type]' =~ /^serv/;
[/condition]
This is a service.
[/if]
If it were me I would probably take the easy way out and do it with calc...
[seti dl_type][calc]
my $dl_type = '[item-field dl_type]';
if($dl_type =~ /^serv/) {
return 'service';
} elsif($dl_type =~ /^soft/) {
return 'soft';
} else {
return 'unknown';
}
[/calc][/seti]
Then you could check what it was with
[if scratch type eq 'service']
[comment]This is a provisioned service[/comment]
This is a provisioned service.
[elsif scratch type eq 'soft']
[comment]This is a soft goods download[/comment]
[set download_present]1[/set]
[userdb
function=set_file_acl
mode="expire 7 days"
location="[either][item-field dl_location][or][item-code][/either]
[/elsif]
[else]
[comment]Unknown type[/comment]
Unknown type: [scratch dl_type]
[/else]
[/if]
>
> > > ------------------------------^snip------------------------------
> > > [item-list]
> > > [if-item-field download]
> > > [if !value fax_order]
> > > [if item-field dl_type =~ /^serv/i]
> > > [comment]This is a provisioned service[/comment]
> > > This is a provisioned service.
> > > [elsif item-field dl_type =~ /^soft/i]
> > > [comment]This is a soft goods download[/comment]
> > > This is a soft goods download.
> > > [set download_present]1[/set]
> > > [userdb
> > > function=set_file_acl
> > > mode="expire 7 days"
> > > location="[either][item-field
> > > dl_location][or][item-code][/either
> > > ]"
> > > ]
> > > [/elsif]
> > > [else]
> > > [comment]Unknown type[/comment]
> > > Unknown type: [item-field dl_type]
> > > [/else]
> > > [/if]
> > > [/if]
> > > [/if-item-field]
> > > [/item-list]
> > > ------------------------------^snip------------------------------
> > >
> > > Thanks
> > > -Matt
>
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users
--
Red Hat E-Business Solutions Jason Kohles
11480 Sunset Hills Road Senior System Architect
Reston, VA 20190 jkohles@redhat.com