Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excluding Records

Status
Not open for further replies.
Apr 6, 2001
41
US
I want to allow my users to exclude records of their choice. If you go to the link below you'll get an idea of what I want...


See the left-most column of the table that says "Exclude" and then all the checkboxes down the column? Let me explain what those are: suppose that in the past, one of my users has had a bad experience with one of these companies. Is it possible for a user to click that particular company's checkbox and then click a "recalculate this page" button at the bottom of the page to refresh it with the unwanted record(s) excluded on the refreshed page? How could it be done?

Your help is appreciated!
 
There are two ways I can see you progressing this.
THe first is two create a new table in your database that just holds a list of the primary keys. In the ASP that writes the page you then need to run through this table before you write a record to the html. This is really going to put extra load on your page.

The better option (in my opinion) is to add an extra field to the table you are querying. Something like Excluded and a boolean datatype. Now, when you press submit the database can be updated to toggle the Excluded field for any records with the checkbox checked. All you need to do then is to add "WHERE EXCLUDED=FALSE" to your SQL query (or AND it with your other requists). As you are using SQL SELECT to get the correct recordset this will improve performance.

Hope this helps.

G -GTM Solutions, Home of USITE-
-=
 
Your second suggestion sounds great but I don't exactly know how to implement what you recommend because the WHERE statement on verify.asp has other requests in it (with good help from my friend "gny"). I'll be honest, I'm not the slickest programmer...yet. But I'm working on it. :)

I have added a field called "Exclude" on the table being queried. Please could you give me a little more guidance in your SQL statement suggestion? I'm learning as we go. Here's the SQL statement...


<%
dim sWhere
dim sItem

set rsVerify = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsVerify.ActiveConnection = MM_connectionXxXXXX_STRING

sWhere=&quot;&quot;
for each item in request(&quot;id_industry&quot;)
sItem =Replace(item, &quot;'&quot;, &quot;''&quot;)
'*** check if this is the first item
if sWhere = &quot;&quot; then
sWhere = &quot; WHERE id_industry ='&quot; & sItem & &quot;'&quot;
else
sWhere = sWhere & &quot; OR id_industry ='&quot; & sItem & &quot;'&quot;
end if
next
rsVerify.Source = &quot;SELECT Exclude, Industry, Company, City, State, Contact, Phone, Fax, Email, Website FROM FOI&quot; & sWhere & &quot; ORDER BY Industry ASC&quot;
rsVerify.CursorType = 0
rsVerify.CursorLocation = 2
rsVerify.LockType = 3
rsVerify.Open()
rsVerify_numRows = 0
%>

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top