using contains for multiple numbers
Nancy Palmquist
Nancy.Palmquist at vss3.com
Mon Jul 14 07:16:44 PDT 2014
On 7/11/2014 12:44 PM, Jay Ashworth wrote:
> ----- Original Message -----
>> From: "Richard D. Williams" <richard at appgrp.net>
>> I have not done this, for a long time and I know I have see it done.
>>
>> I have a field that may or may not contain a number (0-9).
>>
>> I want to write an IF statement testing this to be true or false.
>>
>> Is it,
>> if : 4 co "123467890"
>>
>> or
>>
>> if : "1234567890" co 4
>>
>> or
>> if : "0|1|2|3|4|5|6|7|8|9" co 4
> The second, unless you can't guarantee that 4 is a single character field,
> in which case the third is smarter. The third is always more rugged.
>
> Cheers,
> -- jra
I would make this modification.
if : "|0|1|2|3|4|5|6|7|8|9|" co "|"{4{"|"
Enclosed all values with pipes and also the field number. this will never match a null value in field 4.
This will also work if the values have differing lengths.
if : "|01|002|30|45|045|60000|007|8|9|" co "|"{4{"|"
This will always work correctly, where "0" would match four of those possible solutions but is not a valid solution itself.
This equivalency logic is difficult sometimes but can also be helpful. But it has bit me more than once.
Nancy
--
Nancy Palmquist
Owner
Virtual Software Systems - www.vss3.com
(412) 835-9417
More information about the Filepro-list
mailing list