Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 10:31 Der er 12 kommentarer og
1 løsning

Repeat region

Jeg arbejder i Dreamweaver MX, og har lavet en recordset1 i dokument1 - der referere til recordset2 i dokument2.

Den virker korrekt - den henter de rigtige data.

Problemet kommer når den skal bruge repeat region på resultatdataerne i dokument2. Disse bliver sorteret på dato.
Avatar billede pelkjaer Nybegynder
24. juli 2002 - 10:33 #1
Og hvad er problemet?
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 10:42 #2
Jeg har dok1 med en liste over en række deltagere. Jeg kan her gå ind og kigge på en bestemt deltager og se hvordan denne har klaret sig i tidligere løb.

I dok2 er nogle datatyper der kun forekommer 1 gang. Fx. navn - reg. nr. - forening.

Andre data forekommer flere gang - det er løbsdato - tid - pladsering.

Første linje i "andre data" er rigtig, men derefter viser den blot de data der kom efter første linje i databasetabellen.
Avatar billede pelkjaer Nybegynder
24. juli 2002 - 10:45 #3
Jeg er ikke sikker på at jeg er helt med, men hvis første linje er korrekt, markerer du da blot den og vælger "repeat region" og recordset.
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 10:47 #4
Det er netop det jeg har gjort, men det virker underligt nok ikke!
Avatar billede pelkjaer Nybegynder
24. juli 2002 - 10:50 #5
Har du sat noget "url parameter" i dit recordset?
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 10:56 #6
Ja
Avatar billede pelkjaer Nybegynder
24. juli 2002 - 10:58 #7
Hvad sker der hvis du ikke har det?
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 11:14 #8
Det tillader den ikke!
Avatar billede pelkjaer Nybegynder
24. juli 2002 - 11:19 #9
Nå, og hvorfor så ikke det?
Kunne også er det din database struktur den er gal med.

Lidt svært at hjælpe når du er så sparsom med dine oplysninger og kode.
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 11:21 #10
Hvad vil du gerne se?
Avatar billede pelkjaer Nybegynder
24. juli 2002 - 11:27 #11
Din kode og eller en url. Samt en uddybning af problemet.

Du siger at første linje er ok, derefter viser den blot resten af data'ne i tabellen. Det er også det er repeat region skal gøre.

Så jeg har lidt svært ved at forstå problemet.
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 11:34 #12
DOK1:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conmarimancup.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conmarimancup_STRING
Recordset1.Source = "SELECT *  FROM deltagerne  ORDER BY Ejer ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="da">
<title>MARIMAN Cup 2002</title>

<META NAME="Description" CONTENT="MARIMAN Cup 2002">
<META NAME="Keywords" CONTENT="mariman, cup, 2002, brevdue, due, meldgaard, dyr, dyrehandel">
<META NAME="Robots" CONTENT="ALL">
<LINK REV=made href="mailto:webmaster@meldgaard.com">
<META HTTP-EQUIV="Reply-to" CONTENT="webmaster@meldgaard.com">

<META NAME="DC.Title" CONTENT="MARIMAN Cup 2002">
<META NAME="DC.Description" CONTENT="MARIMAN Cup 2002">
<META NAME="DC.Subject" CONTENT="mariman, cup, 2002, brevdue, meldgaard, dyr, dyrehandel">

<link rel=stylesheet href="http://www.meldgaard.com/meldgaardstyle.css" type="text/css">

<style type="text/css">
BODY{
  scrollbar-3d-light-color: #e0dacc;
  scrollbar-arrow-color: #ffffff;
  scrollbar-base-color: #e0dacc;
  scrollbar-dark-shadow-color: #a09688;
  scrollbar-face-color: #e0dacc;
  scrollbar-highlight-color: #ffffff;
  scrollbar-shadow-color: #ffffff;
}
</style>

</head>

<body topmargin="0" leftmargin="0">
<!--Indhold/start-->
<table border="0" width="482" cellspacing="0" cellpadding="0" height="100%">
  <tr>
    <td width="482" class=indhold height="20"><span style="font-weight: bold; font-face: verdana, arial, helvetica; font-size: 12px; color: #000000">Deltagende duer</span></td>
  </tr>
  <tr valign="top">
    <td width="482" class=indhold height="2" bgcolor="#000000"></td>
  </tr>
  <tr valign="top">
    <td width="482" height="100%"><br>
      <table border="0" width="482" cellspacing="0" cellpadding="0">
        <tr>
          <td width="100" align="center" class=indhold><font color="#000000"><b>Duenr.</b></font></td>
          <td width="200" align="center" class=indhold><font color="#000000"><b>Ejer</b></font></td>
          <td width="100"></td>
          <td width="82"></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#000000" height="1"></td>
          <td colspan="2" bgcolor="#000000" height="1"></td>
        </tr>
        <%
Dim RecordCounter
RecordCounter = 0
%>
        <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
        <tr bgcolor=
    <%
    RecordCounter = RecordCounter + 1
    If RecordCounter Mod 2 = 1 Then
        Response.Write "#ffffff"
    Else
        Response.Write "#eeeeee"
    End If
    %>>
          <td width="100" align="center" class=indhold><font color="#000000"><%=(Recordset1.Fields.Item("Duenr").Value)%></font></td>
          <td width="200" align="center" class=indhold><font color="#000000"><%=(Recordset1.Fields.Item("Ejer").Value)%></font></td>
          <td width="100" align="center" class=indhold><font color="#000000"><A HREF="dkstatuslistestatus.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "Duenr=" & Recordset1.Fields.Item("Duenr").Value %>" class=tekstlink6><span style='mso-char-type: symbol; mso-symbol-font-family: Wingdings; mso-bidi-font-size: 10.0pt; font-family: Wingdings; mso-ascii-font-family: Arial; mso-fareast-font-family: Times New Roman; mso-hansi-font-family: Arial; mso-bidi-font-family: Times New Roman; mso-ansi-language: DA; mso-fareast-language: DA; mso-bidi-language: AR-SA'><font size="1">à</font></span>
            Se status</A></font></td>
          <td width="82"></td>
        </tr>
        <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
</table>
    </td>
  </tr>
  </table>
<!--Indhold/slut-->
</body>

</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


DOK2:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conmarimancup.asp" -->
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_conmarimancup_STRING
Recordset2.Source = "SELECT * FROM status ORDER BY Statusdato DESC"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
Recordset2_numRows = Recordset2_numRows + Repeat1__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim Recordset2_total
Dim Recordset2_first
Dim Recordset2_last

' set the record count
Recordset2_total = Recordset2.RecordCount

' set the number of rows displayed on this page
If (Recordset2_numRows < 0) Then
  Recordset2_numRows = Recordset2_total
Elseif (Recordset2_numRows = 0) Then
  Recordset2_numRows = 1
End If

' set the first and last displayed record
Recordset2_first = 1
Recordset2_last  = Recordset2_first + Recordset2_numRows - 1

' if we have the correct record count, check the other stats
If (Recordset2_total <> -1) Then
  If (Recordset2_first > Recordset2_total) Then
    Recordset2_first = Recordset2_total
  End If
  If (Recordset2_last > Recordset2_total) Then
    Recordset2_last = Recordset2_total
  End If
  If (Recordset2_numRows > Recordset2_total) Then
    Recordset2_numRows = Recordset2_total
  End If
End If
%>

<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables

Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined

Dim MM_param
Dim MM_index

Set MM_rs    = Recordset2
MM_rsCount  = Recordset2_total
MM_size      = Recordset2_numRows
MM_uniqueCol = "Duenr"
MM_paramName = "Duenr"
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Specific Record: handle detail parameter

If (MM_paramIsDefined And MM_rsCount <> 0) Then

  ' get the value of the parameter
  MM_param = Request.QueryString(MM_paramName)

  ' find the record with the unique column value equal to the parameter value
  MM_offset = 0
  Do While (Not MM_rs.EOF)
    If (CStr(MM_rs.Fields.Item(MM_uniqueCol).Value) = MM_param) Then
      Exit Do
    End If
    MM_offset = MM_offset + 1
    MM_rs.MoveNext
  Loop

  ' if not found, set the number of records and reset the cursor
  If (MM_rs.EOF) Then
    If (MM_rsCount < 0) Then
      MM_rsCount = MM_offset
    End If
    If (MM_size < 0 Or MM_size > MM_offset) Then
      MM_size = MM_offset
    End If
    MM_offset = 0

    ' reset the cursor to the beginning
    If (MM_rs.CursorType > 0) Then
      MM_rs.MoveFirst
    Else
      MM_rs.Close
      MM_rs.Open
    End If
  End If

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  MM_index = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsCount) Then
      MM_size = MM_rsCount
    End If
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rs.EOF And MM_index < MM_offset)
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
Recordset2_first = MM_offset + 1
Recordset2_last  = MM_offset + MM_size

If (MM_rsCount <> -1) Then
  If (Recordset2_first > MM_rsCount) Then
    Recordset2_first = MM_rsCount
  End If
  If (Recordset2_last > MM_rsCount) Then
    Recordset2_last = MM_rsCount
  End If
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="da">
<title>MARIMAN Cup 2002</title>

<META NAME="Description" CONTENT="MARIMAN Cup 2002">
<META NAME="Keywords" CONTENT="mariman, cup, 2002, brevdue, due, meldgaard, dyr, dyrehandel">
<META NAME="Robots" CONTENT="ALL">
<LINK REV=made href="mailto:webmaster@meldgaard.com">
<META HTTP-EQUIV="Reply-to" CONTENT="webmaster@meldgaard.com">

<META NAME="DC.Title" CONTENT="MARIMAN Cup 2002">
<META NAME="DC.Description" CONTENT="MARIMAN Cup 2002">
<META NAME="DC.Subject" CONTENT="mariman, cup, 2002, brevdue, meldgaard, dyr, dyrehandel">

<link rel=stylesheet href="http://www.meldgaard.com/meldgaardstyle.css" type="text/css">

<style type="text/css">
BODY{
  scrollbar-3d-light-color: #e0dacc;
  scrollbar-arrow-color: #ffffff;
  scrollbar-base-color: #e0dacc;
  scrollbar-dark-shadow-color: #a09688;
  scrollbar-face-color: #e0dacc;
  scrollbar-highlight-color: #ffffff;
  scrollbar-shadow-color: #ffffff;
}
</style>

</head>

<body topmargin="0" leftmargin="0">
<!--Indhold/start-->
<table border="0" width="482" cellspacing="0" cellpadding="0" height="100%">
  <tr>
    <td width="482" class=indhold height="20"><span style="font-weight: bold; font-face: verdana, arial, helvetica; font-size: 12px; color: #000000">Duenr.:
      <%=(Recordset2.Fields.Item("Duenr").Value)%> </span></td>
  </tr>
  <tr valign="top">
    <td width="482" class=indhold height="2" bgcolor="#000000"></td>
  </tr>
  <tr valign="top">
    <td width="482" height="100%"><br>
      <table border="0" width="482" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4" class=indhold><font color="#000000"><b>Ejer: <%=(Recordset2.Fields.Item("Ejer").Value)%></b></font></td>
        </tr>
        <tr>
          <td colspan="4" class=indhold><font color="#000000"><b>Forening: <%=(Recordset2.Fields.Item("Forening").Value)%></b></font></td>
        </tr>
        <tr>
          <td colspan="4" height="10"></td>
        </tr>
        <tr>
          <td align="center" class=indhold><font color="#000000"><b>Status</b></font></td>
          <td align="center" class=indhold><font color="#000000"><b>Nr.</b></font></td>
          <td align="center" class=indhold><font color="#000000"><b>Dato</b></font></td>
          <td align="center" class=indhold><font color="#000000"><b>Hjem kl.</b></font></td>
        </tr>
        <tr>
          <td colspan="4" bgcolor="#000000" height="1"></td>
        </tr>
        <%
Dim RecordCounter
RecordCounter = 0
%>
        <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset2.EOF))
%>
        <tr bgcolor=
    <%
    RecordCounter = RecordCounter + 1
    If RecordCounter Mod 2 = 1 Then
        Response.Write "#ffffff"
    Else
        Response.Write "#eeeeee"
    End If
    %>>
          <td align="center" class=indhold><font color="#000000"><%=(Recordset2.Fields.Item("Statusdato").Value)%></font></td>
          <td align="center" class=indhold><font color="#000000"><%=(Recordset2.Fields.Item("Pladsering").Value)%></font></td>
          <td align="center" class=indhold><font color="#000000"><%=(Recordset2.Fields.Item("Dato").Value)%></font></td>
          <td align="center" class=indhold><font color="#000000"><%=(Recordset2.Fields.Item("Klokken").Value)%></font></td>
        </tr>
        <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset2.MoveNext()
Wend
%>
</table>
    </td>
  </tr>
  </table>
<!--Indhold/slut-->
</body>

</html>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>


DATABASE RECORDSET1:

Duenr - Tekst
Forening - Tekst
Ejer - Tekst
ID - Auto (nøgle)

DATABASE RECORDSET2:

Duenr - Tekst
Forening - Tekst
Ejer - Tekst
Pladsering - Tal
Pladsskjul - Tal
Dato - Tekst
Klokken - Tekst
Statusdato - Dato (kort format)
ID - Auto (nøgle)

Problem: Repeat region i DOK2, linje 1 er eneste linje der vises korrekt!
Avatar billede mit_navn_er Nybegynder
24. juli 2002 - 12:43 #13
Har selv løst det!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester