Solved

repeat regions..ASP..MSSQL and NOT repeating

Posted on 2004-09-01
2
273 Views
Last Modified: 2010-04-25
Ok
I've queried two tables as such
SELECT dbo.tutee.idratuteeid AS idratuteeid,  
 dbo.tutee.firstname AS tutee_fisttname,        
dbo.tutee.lastname AS tutee_lastname,        
dbo.tutee.mi as tutee_mi,      
  dbo.tutee.gradelevel as gradelevel,      
  dbo.tutee.room as room,    
     dbo.tutee.elemteacherid as tutee_elemteacherid,        
dbo.elemteacher.elemteacherid as teacher_elemteacherid,    
    dbo.elemteacher.firstname as teacher_firstname,      
  dbo.elemteacher.lastname as teacher_lastname,
 dbo.studentdemo.idrastudentid as studentdemoidrastudentid,  
dbo.tutee.idrastudentid as tuteeidrastudentid,  
dbo.studentdemo.firstname as tutorfirstname,
 dbo.studentdemo.lastname as tutorlastname

FROM dbo.tutee, dbo.elemteacher, dbo.studentdemo

WHERE dbo.elemteacher.elemteacherid=dbo.tutee.elemteacherid  AND dbo.tutee.idrastudentid=dbo.studentdemo.idrastudentid  AND dbo.tutee.teachercoordid = MMColParam

And This works for lots of different things....bnut
Now I'm looking for to make a repeated region where the tutorfirstname that is associated with several tutees ONLY shows up once as the repeated region is populated
Right now it just gives me a list like this

tutee tuteeinfo tutorone
tuteeone tuteeinfo tutorone
tuteetwo  tuteeinfo tutorone

tutee tuteeinfo tutortwo
tuteeone tuteeinfo tutortwo
tuteetwo  tuteeinfo tutortwo

What I would like to see is

Tutorone
tutee tuteeinfo
tuteeone tuteeinfo
tuteetwo  tuteeinfo

Tutortwo
tutee tuteeinfo
tuteeone tuteeinfo
tuteetwo  tuteeinfo

I figure that this is an ASP question and not really a SQL question but I included the SQL statement
Is there any way to simply tweak Dreamweaver's repeated region behaviors...or am I just high

0
Comment
Question by:hbojorquezgeek
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
ecupd earned 500 total points
ID: 11969660
typed all this in yesterday then clicked accidently clicked back and lost it GRRR

Hi hbojorquezgeek,

You will have to get into the code a tiny bit rather that relying on DW's inbuilt functions (to the best of my knowledge anyhows)

First thing add to the end of your SQL (after MMcolParam) so this will work the following:
& " ORDER BY dbo.studentdemo.firstname"
this will ensure the info comes out in the correct order for this to work

at the moment you have something akin to:
-------------------------------
 <table>
 <% While ((Repeat1__numRows <> 0) AND (NOT recordset1.EOF)) %>
<tr>
<td><%=(recordset1.fields.item("tutorfirstname").value)%></td>
<td><%=(recordset1.fields.item("tutee_fisttname").value)%></td>
<td><%=(recordset1.fields.item("tutee_lastname").value)%></td>
</tr>
 <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  recordset1.MoveNext()
Wend
%>
</table>
---------------------------------------
replace it with the following should work:
---------------------------------------
 <table>
 <% While ((Repeat1__numRows <> 0) AND (NOT recordset1.EOF)) %>
 <% if temporaryVariable <> recordset1.fields.item("tutorfirstname").value then %>
 <!--
        #### this will only display for the first instance of a new tutorfirstname
        ####in the first case temporaryvariable  will be nothing in all subsequent cases temporaryvariable will be the previous record
  -->
      <tr><td colspan="2"><%=(recordset1.fields.item("tutorfirstname").value)%></td></tr>
 <% end if %>
 <!-- #### all this will display regardless - edit to suit, edit what needs to be displayed -->
<tr>
<td><%=(recordset1.fields.item("tutee_fisttname").value)%></td>
<td><%=(recordset1.fields.item("tutee_lastname").value)%></td>
</tr>
 <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1

  '#### this is where we set the temporary variable so the check can be done at the top
  temporaryVariable = recordset1.fields.item("tutorfirstname").value
 
  recordset1.MoveNext()
Wend
%>
----------------------------------------

If I have missed anything paste the resulting generated HTML (view source in browser) and I will take a peek

Cheers,

dayton
0
 
LVL 2

Expert Comment

by:ecupd
ID: 11969666
BTW as for mental state depends on if what you were smokin was any good ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
A short film showing how OnPage and Connectwise integration works.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now