[ic] efficiency experts! 20,000 iterations, please give me direction ->^<-

Paul Jordan interchange-users@icdevgroup.org
Fri Jan 24 00:53:00 2003


Hi guys

OK, first off let me say I don't buy into the whole salutation thing, but my
sister has a travel&tour company, and her clients can get very disjointed if
you address them incorrectly. Most are > 65 so they are used to a more
traditional level of interaction, not that there is anything wrong with
that. Since it is > 65 there are alot of separate last names too.

That said, I have no choice but to adhere. The below pseudo iteration
figures out if the spouse has a different last name is a doctor, then if the
client himself is a doctor, if their not and still have different last
names, if they have same last names, and so on and on.

This is all fine and dandy for like say a flypage, or a short list. However
she needs to generate 10,000, 15,000, 20,000 clients list for mailing (snail
mail) on a regular basis. Looping through the below 20,000 times for an
output file is not going to be pretty. (and this is just for the name, not
the address)

----------------------------------PSEUDO
CODE---------------------------------------


[if-loop-param spouse_lname]
	<!-- if spouse has different last name -->
  [if-loop-param spouse_salutation eq 'Dr.']
	<!-- if the above and is a doctor -->
    [if-loop-param salutation eq 'Dr.']
	<!-- if all of above and client is a doctor -->
      Drs. [loop-param fname] [loop-param lname] & [loop-param spouse]
[loop-param spouse_lname]
    [else]
	<!-- if spouse has different last name and client is not a doctor -->
      Dr. [loop-param spouse] [loop-param spouse_lname] & [loop-param
salutation] [loop-param fname] [loop-param lname]
    [/if-loop-param]
  [else]
	<!-- if neither are doctors, but still have different last names -->
     [loop-param salutation] [loop-param fname] [loop-param lname] <br>
[loop-param spouse salutation] [loop-param spouse] [loop-param spouse_lname]
  [/if-loop-param]
	<!-- if both have same last name -->
[else]
	<!-- if the spouse is a doctor  -->
  [if-loop-param spouse_salutation eq 'Dr.']
	<!-- if the above and is a doctor -->
    [if-loop-param salutation eq 'Dr.']
	<!-- if all of above and client is a doctor -->
      Drs. [loop-param fname] & [loop-param spouse] [loop-param lname]
    [else]
	<!-- if client is not a doctor -->
      Dr. [loop-param spouse] [loop-param lname] & [loop-param salutation]
[loop-param fname] [loop-param lname]
    [/if-loop-param]
  [else]
	<!-- if neither are doctors -->
     [loop-param salutation] & [loop-param spouse salutation] [loop-param
fname] [loop-param lname]
  [/if-loop-param]

[/if-loop-param]

------------------------------------------------------------------------

column names have been changed for readability.

What are my options? There is [loop-sub routine], but still this is way too
much even for that. I was thinking of possibly having an additional column
called "greeting" then use the above like a tool somehow and have it run
through a database and copy the result into that rows "greeting" column.
Then every time someone(we) edits, or adds, it can run it through the above,
and into the greeting column. So, it would require me to run the above ONCE
on the entire table of 20,000, then (on)EACH time a userdb record is edited,
or added (which individually is not too big a deal).

I have been thinking about this all week, and that seems to be my only real
option. The question is, is that possible? Would this be something to be
done in perl, and have it "go over" userdb once after/during I upload it the
first time?

Am I correct in any of this? Is this the direction to go with this?

TIA

Paul