Solved

repeat regions..ASP..MSSQL and NOT repeating

Posted on 2004-09-01
2
276 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 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