Question about Multi-Field Indexes

John Esak john at valar.com
Tue Aug 31 21:02:41 PDT 2010


Mark,

Scott is right... And of course, thereby so are you. Just one comment. You
mentioned taking the original fields and concatenating them into a dummy
field to compare against something... Whatever.  Well, my suggestion is
*don't* put them in a dummy just to concatenate them.  Use the actual fields
as in 

    if: compare(4 & 19,ZZ) eq "0"

-1 exp1 lt exp2
 0 exp1 eq exp2
 1 exp1 gt exp2


That way you don't run the risk of any edit type of the dummies changing the
shape of the data in any way.  The ampersand is of course how the index will
put the fields together when it combines its segments, so this is the most
solid compare you can do. Actually I never use the COMPARE unless I'm
worried about case.  Usually I just do something like:

   if: 4 & 19 { "x" eq ZZ { "x"	 

Which you can see would do the same thing.  Assuming (damn) that ZZ is a
good representation of your two fields in the first place.  :-)

If the fields are looked up fields, same thing, use the actual fields not
thrown into dummies:

  if:  lkp(4) & lkp(19) { "x" eq ZZ { "x"

I don't know why I'm going on like this... You certainly know this stuff
better than I. But I often see people who don't use filePro much throwing
everything into dummies first before using the values.  Howie showed me long
ago that just using the "thing" (i.e., expression) itself was 99% of the
time good enough. It's made me a much more economical (dare I say elegant)
filePro programmer.

John


> -----Original Message-----
> From: filepro-list-bounces+john=valar.com at lists.celestial.com 
> [mailto:filepro-list-bounces+john=valar.com at lists.celestial.co
> m] On Behalf Of Fairlight
> Sent: Tuesday, August 31, 2010 10:41 PM
> To: filePro Mailing List
> Subject: Question about Multi-Field Indexes
> 
> fP 5.0.14
> 
> I have data that is actually stored in two fields.  The data 
> I get from
> user input is one field...a solid concatenation of those two 
> fields, always
> in the same order.
> 
> I built an index across those fields, in that order.
> 
> However, I still need to actually grab both fields and concatenate and
> -then- compare the result to my user input, all in the 
> getnext loop, right?
> 
> Just double-checking...been a while since I've been doing 
> active fP coding.
> Normally, I'd just make one field that has the concatenation 
> and build the
> index on -that-.  I'm under the assumption that I can use a 
> multi-field
> index across both fields, and just grab the separate fields 
> and concatenate
> them into a dummy field to compare to user input, and it 
> should come out
> the same either way.
> 
> Am I correct, or incorrect?
> 
> mark->
> -- 
> Fairlight->   ||| He's a real nowhere man, sitting   | 
> Fairlight Consulting
>   __/\__      ||| on his nowhere LAN, sending all    | 
> http://www.fairlite.com
>  <__<>__>     ||| his nowhere SPAM to nobody...      | 
> fairlite at fairlite.com
>     \/        |||                                    | (502) 509-3840
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
> 



More information about the Filepro-list mailing list