lookup field

Kenneth Brody kenbrody at spamcop.net
Sun Mar 13 08:37:01 PDT 2011


On 3/12/2011 12:00 PM, Richard Kreiss wrote:
> I have a lookup to a 60 character field which was originally to hold a name.
> As my client never used that field for this purpose, we decided to use it to
> hold a "NY" to indicate the person associated was in New York.  Yes, there
> is a state field with NY, but this is a subset of those, plus some in either
> new jersey or Conn. Can be part of the NY subset.
>
>
>
> My program checks
>
> If: foobar(34)="Ny"
> Then: IsNewYork="Y"

That will set IsNewYork to "Y" if the first two characters of foobar(34) are 
"ny".

> This allow branching to handle those records in this subset.  However I am
> getting records posted that are not part of the NY subset.

How, exactly, do you "get records posted"?

> Since they do not want me to resize the field I need to do one of these in
> my program.

You don't need to do any of the following things.

> If: mid(foobar(34),"1",'2"0="NY"
> Then: IsNewYork="Y"

That is identical in meaning to your original version.  (Well, except for 
the typos.  Have you considered using copy-and-paste, rather than using 
error-prone retyping?)

> Or
>
> If:
> Then: ny(2,*)=foobar(34)
> If: ny="Ny"
> Then:isNewYork="Y"

That, too, is identical in meaning.

> My thought is to use option 1.

Then do so.

> More to the question, foobar(34) is blank in all records except for those in
> the NY subset.  Why would IsNewYork be set if foobar(34) is blank?

The code above would not set IsNewYork to "Y" unless the first two 
characters of foobar(34) were "ny".

Whether or not something else in the processing (of which you've only given 
us the single line above) sets IsNewYork, or whether or not something else 
in the processing "posts records" despite IsNewYork not being set, we have 
no way of knowing.

Why not add a message box at the point where you will actually post a 
record, showing the contents of IsNewYork and foobar(34)?  (This, of course, 
assumes that nothing else in processing will change what record the foobar 
lookup points to, nor does it change field 34 after executing the above line.)

[...]

-- 
Kenneth Brody


More information about the Filepro-list mailing list