[ic] Test for null value in loop search?

Grant emailgrant at gmail.com
Wed Apr 22 03:10:54 UTC 2009


>> Can I test for a null value in a loop search?  The following doesn't
>> seem to work:
>>
>> sf=name/se=/op=eq/nu=0
>
>
> There currently is no operator that does that of which I'm aware, but
> it's easy to add your own custom operator for that to catalog.cfg (note
> that this may have to go in interchange.cfg, I'm not 100% sure):
>
> CodeDef  isnull  SearchOp
> CodeDef  isnull  Routine  <<EOR
> sub {
>    return sub {
>        my $string = shift;
>        return !defined $string;
>    };
> }
> EOR
>
>
> then: sf=name/se=/op=isnull
>
>
> Note that the above is untested, I think it will work, but no guarantees.
>
>
> Peter

Thanks Peter.  Since a non-null value would always be a positive
number in this case, I had a workaround going like this:

ne=1/sf=name/se=0/op=>/nu=1

- Grant



More information about the interchange-users mailing list