It works great!
Thanks Nate. At 01:23 PM 3/5/2002 -0600, you wrote: >sorry one that looks like ><cfset dbSti[loopcount][2] = GetFontFamily.ID> >and one that looks like ><cfset dbSti[loopAddCount][2] = GetFontFamily.ID> > >change the "2" to a "1" > >=D > > >----- Original Message ----- >From: "Nate Nielsen" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Tuesday, March 05, 2002 1:21 PM >Subject: Re: Help...correction > > > > there are two lines that look like this: > > > > <cfset dbSti[loopAddCount][2] = GetFontFamily.ID> > > > > change to: > > > > <cfset dbSti[loopAddCount][1] = GetFontFamily.ID> > > > > > > Nate Nielsen > > [EMAIL PROTECTED] > > 817.726.8644 > > > > ----- Original Message ----- > > From: "phumes1" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, March 05, 2002 1:14 PM > > Subject: Re: Help...correction > > > > > > > > > > I seem to be getting an error > > > > > > Error Occurred While Processing Request > > > Error Diagnostic InformationAn error occurred while evaluating the > > > expression: #dbSti[i][1]#Error near line 122, column 23. > > > > > > > > > > > > > > > At 01:09 PM 3/5/2002 -0600, you wrote: > > > >something like this maybe? Made it so that it will use the query to > > search > > > >if there are only a few records in the file, otherwise it uses CF to > > search. > > > >Untested, but should be pretty close > > > > > > > ><!--- READ .STM FILE AND DISPLAY CONTENTS ---> > > > ><cffile action="READ" > > > > file="#DosPath#\#FileNameOnly#" > > > > variable="ReadMe"> > > > ><cfset listDelim = Chr(13) & Chr(10)> > > > ><!--- making an array to hold the file's sti values ---> > > > ><cfset fileSTI = ArrayNew(1)> > > > ><cfset loopcount = 1> > > > ><cfloop list="#ReadMe#" index="i" delimiters="#listDelim#"> > > > > <cfset fileSti[loopcount] = trim(i)> > > > > <cfset loopcount = loopcount + 1> > > > ></cfloop> > > > ><!--- sort array for faster searching ---> > > > ><cfset sortSuccess = ArraySort(fileSti, "textnocase", "asc")> > > > > > > > ><cfset dbSti = ArrayNew(2)> > > > ><!--- if its a short list in the file, use a query to search for > > > >matches ---> > > > ><cfif ArrayLen(fileSti) lte 20> > > > > <cfset stiList = ''> > > > > <cfloop from="1" to="#ArrayLen(fileSti)#" index="i"> > > > > <cfset stiList = ListAppend(stiList, "'#fileSti[i]#.sti'")> > > > > </cfloop> > > > > <cfquery name="GetFontFamily" datasource="fontstyles"> > > > > SELECT sti, ID > > > > FROM fontsti > > > > WHERE sti in(#PreserveSingleQuotes(stiList)#) > > > > ORDER BY sti asc > > > > </cfquery> > > > > <cfset loopcount = 1> > > > > <cfloop query="GetFontFamily"> > > > > <!--- set the matched array ---> > > > > <cfset dbSti[loopcount][2] = GetFontFamily.ID> > > > > <cfset dbSti[loopcount][2] = listGetAt(GetFontFamily.sti, 1, '.')> > > > > <cfset loopcount = loopcount + 1> > > > > </cfloop> > > > ><!--- long file, so use CF to search ---> > > > ><cfelse> > > > > <cfquery name="GetFontFamily" datasource="fontstyles"> > > > > SELECT sti, ID > > > > FROM fontsti > > > > ORDER BY sti asc > > > > </cfquery> > > > > <cfset loopAddCount = 1> > > > > <cfset fileStiList = ArraytoList(fileSti, ",")> > > > > <cfloop query="GetFontFamily"> > > > > <cfif listFindNoCase(fileStiList, listGetAt(GetFontFamily.sti, 1, > > '.'))> > > > > <!--- set the matched array ---> > > > > <cfset dbSti[loopAddCount][2] = GetFontFamily.ID> > > > > <cfset dbSti[loopAddCount][2] = listGetAt(GetFontFamily.sti, 1, >'.')> > > > > <cfset loopAddCount = loopAddCount + 1> > > > > </cfif> > > > > </cfloop> > > > ></cfif> > > > > > > > ><cfloop from="1" to="#arrayLen(dbSti)#" index="i"> > > > > <cfoutput> [#dbSti[i][1]#] #dbSti[i][2]#</cfoutput> > > > ></cfloop> > > > > > > > > > > > >Nate Nielsen > > > >[EMAIL PROTECTED] > > > >817.726.8644 > > > > > > > > > > > >----- Original Message ----- > > > >From: "phumes1" <[EMAIL PROTECTED]> > > > >To: <[EMAIL PROTECTED]> > > > >Sent: Tuesday, March 05, 2002 12:26 PM > > > >Subject: Re: Help...correction > > > > > > > > > > > > > > > > > > Sorry, made a typo. > > > > > > > > > > **REVISION** > > > > > > > > > > Hi all, > > > > > > > > > > I 'm stuck. The below code reads and displays the contents of my > > database. > > > > > > > > > > > > > > > <cfquery name="GetFontFamily" datasource="fontstyles"> > > > > > SELECT sti, ID > > > > > FROM fontsti > > > > > ORDER BY sti > > > > > </cfquery> > > > > > > > > > > <cfoutput query="GetFontFamily"> > > > > > <input type="hidden" name="ID" value="#GetFontFamily.ID#"> > > > > > [#GetFontFamily.ID#] #GetFontFamily.sti#<br> > > > > > </cfoutput> > > > > > > > > > > This displays something like... > > > > > > > > > > [1] aachen.sti > > > > > [2] accolade.sti > > > > > [3] adelon.sti > > > > > [4] amelia.sti > > > > > [5] american-unciale.sti > > > > > [6] angelo.sti > > > > > [7] avantgarde.sti > > > > > [8] ballantines.sti > > > > > [9] bamberg.sti > > > > > [10] baskerville.sti > > > > > [11] bauhaus.sti > > > > > [12] belfast.sti > > > > > [13] bernstein.sti > > > > > [14] birch.sti > > > > > [15] Blackoak.sti > > > > > [16] boascript.sti > > > > > [17] bodoni.sti > > > > > [18] bookman.sti > > > > > [19] borderpi-15159.sti > > > > > [20] boutique.sti > > > > > > > > > > I have an external file that I'm reading in that I want to compare > > against > > > > > the above list and display the appropriate ID numbers. Below is the > > > > > contents of my ASCII file and the code. > > > > > > > > > > file.txt > > > > > -------- > > > > > amelia > > > > > angelo > > > > > ballantines > > > > > baskerville > > > > > belfast > > > > > > > > > > > > > > > <cfoutput> > > > > > <!--- READ .STM FILE AND DISPLAY CONTENTS ---> > > > > > <cffile action="READ" > > > > > file="#DosPath#\#FileNameOnly#" > > > > > variable="ReadMe"> > > > > > <cfset listDelim = Chr(13) & Chr(10)> > > > > > <cfloop list="#ReadMe#" index="i" delimiters="#listDelim#"> > > > > > <input type="checkbox" name="select" > > > > > value="#Trim(i)#.sti">[#GetFontFamily.ID#] #Trim(i)#.sti<br> > > > > > <input type="hidden" name="select" value="#Trim(i)#.sti"> > > > > > </cfloop> > > > > > > > > > > > > > > > This is what gets displayed: > > > > > > > > > > [1] amelia > > > > > [1] angelo > > > > > [1] ballantines > > > > > [1] baskerville > > > > > [1] belfast > > > > > > > > > > How can I display the following? > > > > > > > > > > [4] amelia > > > > > [6] angelo > > > > > [8] ballantines > > > > > [10] baskerville > > > > > [12] belfast > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > This email server is running an evaluation copy of the MailShield > > anti- > > > > > spam software. Please contact your email administrator if you have >any > > > > > questions about this message. MailShield product info: > > www.mailshield.com > > > > > > > > > > ----------------------------------------------- > > > > > To post, send email to [EMAIL PROTECTED] > > > > > To subscribe / unsubscribe: http://www.dfwcfug.org > > > > > > > > > > > > > > > > > >------------------------------------------------------------------------- > > > >This email server is running an evaluation copy of the MailShield anti- > > > >spam software. Please contact your email administrator if you have any > > > >questions about this message. MailShield product info: >www.mailshield.com > > > > > > > >----------------------------------------------- > > > >To post, send email to [EMAIL PROTECTED] > > > >To subscribe / unsubscribe: http://www.dfwcfug.org > > > > > > > > > > ------------------------------------------------------------------------- > > > This email server is running an evaluation copy of the MailShield anti- > > > spam software. Please contact your email administrator if you have any > > > questions about this message. MailShield product info: >www.mailshield.com > > > > > > ----------------------------------------------- > > > To post, send email to [EMAIL PROTECTED] > > > To subscribe / unsubscribe: http://www.dfwcfug.org > > > > > > > > > ------------------------------------------------------------------------- > > This email server is running an evaluation copy of the MailShield anti- > > spam software. Please contact your email administrator if you have any > > questions about this message. MailShield product info: www.mailshield.com > > > > ----------------------------------------------- > > To post, send email to [EMAIL PROTECTED] > > To subscribe / unsubscribe: http://www.dfwcfug.org > > > > >------------------------------------------------------------------------- >This email server is running an evaluation copy of the MailShield anti- >spam software. Please contact your email administrator if you have any >questions about this message. MailShield product info: www.mailshield.com > >----------------------------------------------- >To post, send email to [EMAIL PROTECTED] >To subscribe / unsubscribe: http://www.dfwcfug.org ------------------------------------------------------------------------- This email server is running an evaluation copy of the MailShield anti- spam software. Please contact your email administrator if you have any questions about this message. MailShield product info: www.mailshield.com ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
