Replies Back to Article

Nested Repeat Region using a Recordset Filter

A question
December 9, 2001 by Irakli Garakanidze

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

error
December 9, 2001 by Irakli Garakanidze

sorry,

it was wrong to type 'project done' - it must be "number of done projects"

Thanks

Same table?
January 2, 2002 by Tony Pearce

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

RE: Same table?
January 2, 2002 by Waldo Smeets
It's possible as long as you use 2 recordsets.
Duplicate rows
February 11, 2002 by Michael Tindall

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

RE: Duplicate rows
March 2, 2002 by James Threadgill
You have to set SELECT DISTINCTROW in your query.
Argument Error
August 12, 2002 by Lewis Smith
RE: Argument Error
August 12, 2002 by Tom Steeper

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!

Great tutorial
November 7, 2002 by Yanira Cruz
This explanation about nested repeated regions have been very useful. Thanks for sharing it with us.
ADODB.Recordset error '800a0bb9'
December 13, 2002 by Imani Butler

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

RE: ADODB.Recordset error '800a0bb9'
December 14, 2002 by Tom Steeper

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 

RE: RE: ADODB.Recordset error '800a0bb9'
December 16, 2002 by Imani Butler

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

The best and Quickest I have ever used
December 31, 2002 by Raymond Langley
This is the best and quickest code for nested repeat regions I have ever used
WOW!!!
January 14, 2003 by Mitchel Tendler

Your a genious!!!

Thanks for an AWESOME tutorial!

Mitch (Denver, CO)

What a Savings!!!!
January 16, 2003 by Tod Madderra

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

Need help
February 7, 2003 by Keith Fernandes

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

RE: Need help
February 7, 2003 by Keith Fernandes

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.

RE: Need help on repeat nested regions
February 10, 2003 by Keith Fernandes

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. 

RE: Need help
February 11, 2003 by Keith Fernandes
Have fixed the Javascript code to work correctly giving me the results I require.
Can I use LIKE in the filter?
March 3, 2003 by Phil Grimpo

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?

Help on DW MX
May 23, 2003 by Daniel Brito

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:

Can't make it work
October 16, 2003 by Mike Evanson

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)%>,&nbsp;
                    <%
rsPost.MoveNext();
 }
 %>

Nested Repeat Region using a Recordset Filter
November 25, 2003 by dan cope

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

* retieving the total number of records within a nested repeat
December 15, 2003 by Luke Burgess

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

RE: * retieving the total number of records within a nested repeat
December 15, 2003 by Luke Burgess

No worry. Problem solved. Just incremented a variable from within an external loop.

 

I love this tutorial
June 5, 2004 by Michael DELMOTTE

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

Problem with filters
June 26, 2009 by Melissa Van Dessel

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!

Rowset position cannot be restarted
July 15, 2021 by Steve Bates
I realise this is an old post but some of us dinosaurs still use Classic ASP! I've come across this tutorial which is exactly what I'm after but the code only works if there is a child record present. If there is no child record I get an error: "Rowset position cannot be restarted." Is there anyway I can code around this so it displays child record for those present and doesn't error out if there are none? I've tried all sorts of things but nothing seems to work so far. Any help really appreciated.