tag a record

Jeff Harrison jeffaharrison at yahoo.com
Wed Apr 27 14:03:15 PDT 2005


--- Kenneth Brody <kenbrody at bestweb.net> wrote:
> Quoting Steven Waters (Wed, 27 Apr 2005 12:25:32
> -0700):
> 
> > G-day,
> > I am writing a small program that I want
> > to tag with a "X" duplicate P/N's in a file.
> > I can't figure out how to get the first instance
> > of a duplicate P/N. For example if there are 3
> records
> > with the same P/N I only get a "X" by record 2 and
> 3. record 1
> > is not X'd.
> >
> >   1  -------   -   -
> >         If: 1 eq ab
> >        Then: 12="X";end
> >   2  -------   -   -   -
> >         If: 1 ne ab
> >        Then: ab(40,,g)=1
> [...]
> 
> (Note that the if on line 2 is unnecessary, as it
> can't get there if 1
> is equal to ab.  Not to mention that if 1 is equal
> to ab, the assignment
> won't really have any effect anyway.)
> 
> This should work if you run this in *report while
> sorting on field 1.
> 
> --

I don't think it will.  From what I understand of
Steve's description he wants the first instance of a
given value to be flagged if there are others
instances of that same value in the file.  This
technique will not flag the first instance.

Here is one way to do that.
(assumes field 1 is the key and index a is built on
this field)  BTW, this is untested.

::lookup sam = filename k=1 i=a -nx:
loop:::
:not sam:end:
:sam(@rn) eq @rn:getnext sam; goto loop:
:sam(1) ne 1:end
::12="X":
::end:

Jeff Harrison
jeffaharrison at yahoo.com

Author of JHExport and JHImport.  The easiest and
fastest way to generate code for filePro exports and
imports.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Filepro-list mailing list