Replies Back to Article
Nested Repeat Region using a Recordset Filter
Thank you for the great tutorial. I have a problem: I'm just a beggineg so my question could be easy. I'd doing a websitefor my friend's company which stores some information about donors and projects they had done, so I've got two tables in my database, one is list of donors with primary key DonorID and the second - projects. My friend needs a rable in his site with information like this:
Donor Name - Project Done - total amount of money he spent on projects
How can I do this??
Thank you
sorry,
it was wrong to type 'project done' - it must be "number of done projects"
Thanks
Hi
Is it possible to use the same table for both queries? as I wish to use the first returned recordset to display the title, then a repeated region below to show the other data, using the same column name for both, then reapeating....
Thanks
Tony
How do you hide duplicate rows in the nested region? I'm filtering a Company Table with a Plan table. If a company has more than one plan it shows up in my nested region for every plan it has. I just want the company to be shown once.
Thanks
This happens if the field that you are using to filter with is not a numeric field. Assuming this is the case, you need to modify the following line of code:
rsPages.Filter = "SectionID = " & FilterParam
to
rsPages.Filter = "SectionID ='" & FilterParam & "'"
Note the use of a single quote ( ' ) after the = sign, and inside the set of double quotes at the end of the line.
Hope that helps!
When I try to get this to work using MX, I get the following error
ADODB.Recordseterror '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
The error points to line 57 of my code which contains the following:
groups.Filter = "block_id = " & FilterParam
This is from the code I cut and pasted from the tutorial. The field I am using to filter is a basic text field. I tried to look up information on the error, but both Macromedia and Microsoft Sites describe the cause as the following:
This error can occur when the ADO filter syntax has been structured with OR clauses within parentheses and AND clauses without parentheses. For example, the following filter structure returns the 800a0bb9 error: ...
This is completely irrelevant to my problem.
It appears folks have gotten nested repeats to work, so how do I work around this error. Also, once I get around it, I need a few more levels of nesting to a total of 4 levels. Will I be successful once I get the first level working?
HELP!!!
Imani
This would normally occur if the ID field that you are using in your DB is not a numeric field. If you can change these ID fields in the DB (for both tables that are being used for the recordsets in this tutorial) to numeric, this will fix the problem. If this can't be done because you need alpha-numeric id's in your database (it can happen) change the offending line of code to:
groups.Filter = "block_id = '" & FilterParam & "'"
It may be best to cut-and-paste this line as line now contains a mixture of single quotes ( ' ) and double quotes ( " ).
Hope that helps.
Tom Steeper
Thank you Tom. I got it work. Now, how about getting addional levels of nesting. I need two more bringing the total to 4 levels of nesting. On that fourth level, I need to display more than one field. Is this possible? If so, how do I go about it. I am playing with it, but not sure if my approach is right.
Imani
Your a genious!!!
Thanks for an AWESOME tutorial!
Mitch (Denver, CO)
You crank! That was perfect for my needs. Once I had the ASP shilds in place, I could drag them around to suit my formatting needs. I was able to insert a table to use for the sub-items and it works perfectly.
Thank you very much for your contribution!
TM
I wish to created a nested region using the same table in two recordsets and using Javascript. A label row is to be displayed from the first(or master) recordset and then a row for each filtered entry in the second record set.
The problem I have is that the filter does not work and that separate rows are not displayed for each occurence of the second record set.
The results I have obtained include the header or label row and then all occurences of a 'display' column from the 2nd recordset. But these are displayed in the same row instead of in separate rows.
Thanks for your help.
Keith
The text I have inserted is as follows
<%
FilterParam = rsMaster.Fields.Item("Statmnt_id").Value
rsDetail.Filter = "Statmnt_id = " & FilterParam
while (!rsDetail.EOF) { %>
<%=(rsDetail.Fields.Item("Rater_Typ_CD").Value)%>
<%
rsDetail.MoveNext();
}
%>
In the above, Statmnt_id is the linking field or d/b table column and rater_typ_cd is the field that will be displayed.
Fixed the error in the code to list each item from the second recordset on a separate line.
Still have to get the filter to work.
HELP! HELP!
AM working with Javascript and MX.
I have this in my filter:
rs_KeywordResults.Filter = "ItemName LIKE '%" & FilterParam & "%' OR ItemDescription LIKE '%" & FilterParam & "%' OR Keywords LIKE '%" & FilterParam & "%' "
But it's not returning any results. Can I use LIKE? I know that there are recordsets which will work, but i'm not getting any results.
Ideas?
Is a great tutorial, but i need help to make it work on DreamWeaver MX I get hre following error
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Hotbar 4.2.9.0)
Page:
GET /EPT/Reportes/rpt_DAR_administradores2.asp
Time:
Friday, May 23, 2003, 10:54:05 AM
More information:
This looks great but I just can't make it work for me. It always returns all values in the filtered recordset.
I'm using Javascript and this is my code. Can anyone spot why it won't work ?
<%
FilterParam = rsMembers.Fields.Item("MID").Value
rsPost.Filter = "MemberID = " & FilterParam
while (!rsPost.EOF) {%>
<%=(rsPost.Fields.Item("PostID").Value)%>,
<%
rsPost.MoveNext();
}
%>
I Have been able to use this successfully with one level of filtering, but when i try a 2nd level filtering i get the following error (I have made sure all my Fields are numeric for filtering, so adding the extra ['] & ["] just give me a 'Type Mismatch' error):
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
1st level: (repeats categories per Forum)
<%
FilterParam = rsForums.Fields.Item("forumID").Value
rsCategories.Filter = "forum_ID = " & FilterParam
While (NOT rsCategories.EOF)
%>
2nd Level: (Gets latest Topic per Repeated Category)
<%
FilterParam2 = rsCategories.Fields.Item("LastTopicID")
rsTopics.Filter = "topicID = " & FilterParam2
While (NOT rsTopics.EOF)
%>
this Filter the 'LastTopicID' field as the MasterFilterColumn created in the following SQL Query:
SELECT categories.forum_ID, categories.categoryID, categories.category, categories.categoryDescr, COUNT(topics.topic) AS NoOfTopics, MAX(topics.topicID) AS LastTopicID
FROM categories
LEFT JOIN topics ON categories.categoryID = topics.category_ID
GROUP BY categories.categoryID
Some will say 'you don't need the second' level as it will only retrieve one record, but im stuck on how to do this within the query, as 'MAX(topics.topic) AS LastAddedTopic' doesn't work properly on the Text Field and the Tutoril on how to FilterRecord Sets doesn't work for Repeat Regions!
Plz Help, if you Can :)
Dan Cope
Hello,
I am trying to return the number of matches with each outer record. e.g
department #1 (10 matches)
department #2 (7 matches)
department #3 (0 matches)
Does anyone have any ideas how to do this. I have tried, but I only get a value of 0.
Help!?!?
Thanks,
Luke
No worry. Problem solved. Just incremented a variable from within an external loop.
This tutorial is reql GREAT !!! There's no other word to define it...
It matches most of my needs.
But just one question... If I wanna limit the number of records to display, how to do ?
Thanks for your kind help.
MIKE
It works fine when I'm working with an id that is numeric. But I need to filter with 2 filterparams and thes filters are an nvarchar 50 (string). How can I fix this? Now I get this error:
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Thank you for helping me with this!