Unique table call for table - Posted (1665 Views)
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Currently I have been asked by my father to set him up a log book for his Ham Radio stuff and know what I want to setup using the following database fields:

LOG_ID
LOG_MONTH_YEAR
LOG_CALLSIGN
LOG_YES_NO
LOG_SMILE
LOG_DATE


Code:

 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Unique (LOG_MONTH_YEAR) | Unique (LOG_MONTH_YEAR) | Unique (LOG_MONTH_YEAR) |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Unique (LOG_MONTH_YEAR) | Unique (LOG_MONTH_YEAR) | Unique (LOG_MONTH_YEAR) |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Unique (LOG_MONTH_YEAR) | Unique (LOG_MONTH_YEAR) | Unique (LOG_MONTH_YEAR) |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
| Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) | Data (LOG_CALLSIGN) Y/N (LOG_YES_NO) If Smile (LOG_SMILE) |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I have it grouping the items with the LOG_MONTH_YEAR from the database, but need to have only the 3 columns going across. Here is my code I have:

Code:
 <br />
<%
'Dimension variables
Dim rsVK3PALog 'Holds the recordset for the records in the database

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

%>
<!--#INCLUDE VIRTUAL="/connection.asp" -->
<%

Response.Write ("<table width=""200"" border=""0"" cellpadding=""0"" cellspacing=""0"">")

'Create an ADO recordset object
Set rsVK3PALog = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT VK3PA_LOG.* FROM VK3PA_LOG ORDER BY LOG_MONTH_YEAR, LOG_ID ASC;"

'Open the recordset with the SQL query
rsVK3PALog.Open strSQL, adoCon

Do While NOT rsVK3PALog.EOF
strMonthLog = rsVK3PALog("LOG_MONTH_YEAR")
strLogCounter = strLogCounter + 0

if strMonthLog <> tmpDayOfWeek And strLogCounter <> 1 then
Response.Write (" <tr>")
Response.Write (" <td width=""200"" colspan=""4"" align=""left"">")
Response.Write ("  <br />")
Response.Write (" </td>")
Response.Write (" </tr>")
Response.Write (" <tr>")
Response.Write (" <td width=""200"" colspan=""4"" align=""center"">")
Response.Write (" <font class=""logs_header"">" & strMonthLog &"</font>")
Response.Write (" </td>")
Response.Write (" </tr>")
end if

Response.Write (" <tr>")
Response.Write (" <td width=""10"" align=""left"">")
Response.Write (" <font class=""text3f""> </font>")
Response.Write (" </td>")
Response.Write (" <td width=""140"" align=""left"">")
Response.Write (" <font class=""text3f"">" & rsVK3PALog("LOG_CALLSIGN") & "</font>")
Response.Write (" </td>")
Response.Write (" <td width=""20"" align=""left"">")
Response.Write (" <font class=""text3f"">" & rsVK3PALog("LOG_YES_NO") & "</font>")
Response.Write (" </td>")
Response.Write (" <td width=""30"" align=""middle"" valign=""center"">")
Response.Write (" <font class=""text3f""><img src=""" & strSiteURL & "/forum/forum_images/icon_smile.gif"" width=""15"" height=""15""> </font>")
Response.Write (" </td>")
Response.Write (" </tr>")
startrw = startrw + 1

tmpDayOfWeek = strMonthLog
rsVK3PALog.MoveNext

loop

Response.Write ("</table>")
'Reset server objects
rsVK3PALog.Close
Set rsVK3PALog = Nothing
Set adoCon = Nothing
%>

Is anyone able to help with having the unique tables have 3 columns before writing the next lot of 3 below them?
Cheers,

David Greening
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Advanced Member
Carefree
Posts: 4224
4224
So you want them in groups of five rows, those three columns? Sure, no problem. Change line 28 to say:
Code:

	if (strMonthLog <> tmpDayOfWeek And strLogCounter <> 1) or (startrw/5 = int(startrw/5)) then
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Trying for something like this:


There are a number of different entries for each month and need to include them in each month.
Cheers,

David Greening
Posted
Advanced Member
Carefree
Posts: 4224
4224
OK - Give this a go.
Code:

<%
'Dimension variables
Dim rsVK3PALog 'Holds the recordset for the records in the database

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

%>
<!--#INCLUDE VIRTUAL="/connection.asp" -->
<%

Response.Write ("<table width=""200"" border=""0"" cellpadding=""0"" cellspacing=""0"">")

'Create an ADO recordset object
Set rsVK3PALog = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT VK3PA_LOG.* FROM VK3PA_LOG ORDER BY LOG_MONTH_YEAR, LOG_ID ASC;"

'Open the recordset with the SQL query
rsVK3PALog.Open strSQL, adoCon

if not rsVK3PALOG.EOF then
rsVK3PALOG.MoveFirst
intCounter=1
Do While NOT rsVK3PALog.EOF
strMonthLog = rsVK3PALog("LOG_MONTH_YEAR")
strLogCounter = strLogCounter + 0
if intCounter/3=int(intCounter/3) then
Response.Write (" <tr>")
Response.Write (" <td width=""200"" colspan=""4"" align=""left"">")
Response.Write (" <br />")
Response.Write (" </td>")
Response.Write (" </tr>")
Response.Write (" <tr>")
Response.Write (" <td width=""200"" colspan=""4"" align=""center"">")
Response.Write (" <font class=""logs_header"">" & strMonthLog &"</font>")
Response.Write (" </td>")
Response.Write (" </tr>")
end if
Response.Write (" <tr>")
Response.Write (" <td width=""10"" align=""left"">")
Response.Write (" <font class=""text3f""> </font>")
Response.Write (" </td>")
Response.Write (" <td width=""140"" align=""left"">")
Response.Write (" <font class=""text3f"">" & rsVK3PALog("LOG_CALLSIGN") & "</font>")
Response.Write (" </td>")
Response.Write (" <td width=""20"" align=""left"">")
Response.Write (" <font class=""text3f"">" & rsVK3PALog("LOG_YES_NO") & "</font>")
Response.Write (" </td>")
Response.Write (" <td width=""30"" align=""middle"" valign=""center"">")
Response.Write (" <font class=""text3f""><img src=""" & strSiteURL & "/forum/forum_images/icon_smile.gif"" width=""15"" height=""15""> </font>")
Response.Write (" </td>")
Response.Write (" </tr>")
startrw = startrw + 1
if tmpDayofWeek <> strMonthLog then intCounter=intCounter+1
tmpDayOfWeek = strMonthLog
rsVK3PALog.MoveNext
loop
rsVK3PALog.Close
end if
Response.Write ("</table>")
'Reset server objects
Set rsVK3PALog = Nothing
Set adoCon = Nothing
%>
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Tried it and the code did not work. Showed the items all in the 1 column and only showing 3 items per date range and mixed over the place. Good try but.. I will work on it further to try and get it working later in the week.
Cheers,

David Greening
Posted
Average Member
cripto9t
Posts: 881
881
I have something similar but I use getrows to get the record set. So I might have something in the wrong place. But it looks right to me. Just a matter of opening and closing the tags in the right place :}
Code:
<br />
<%
'Dimension variables
Dim rsVK3PALog 'Holds the recordset for the records in the database

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

%>
<!--#INCLUDE VIRTUAL="/connection.asp" -->
<%
'made table wider to hold 3 cells
Response.Write ("<table width=""600px"" border=""0"" cellpadding=""0"" cellspacing=""0"">")

'Create an ADO recordset object
Set rsVK3PALog = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT VK3PA_LOG.* FROM VK3PA_LOG ORDER BY LOG_MONTH_YEAR, LOG_ID ASC;"

'Open the recordset with the SQL query
rsVK3PALog.Open strSQL, adoCon


if not rsVK3PALog.EOF then
'Give variables an initial value

Dim intCols: intCols = 3 'number of columns
Dim intColPnt: intColPnt = 1 'column pointer
Dim strLastMonthLog: strLastMonthLog = "dummy" 'last month
Dim strColWidth

select case intCols
case 1
strColWidth = "100%"
case 2
strColWidth = "50%"
case 3
strColWidth = "33%"
case 4
strColWidth = "25%"
case 5
strColWidth = "20%"
case 6
strColWidth = "16.5%"
end select

Do While NOT rsVK3PALog.EOF
strMonthLog = rsVK3PALog("LOG_MONTH_YEAR")

'close month cell if needed
if strLastMonthLog <> "dummy" then
if strMonthLog <> strLastMonthLog then
Response.Write (" </table></td>")
end if
end if


'reset column counter to 1 and close row if needed
if intColPnt > intCols then
intColPnt = 1
Response.Write (" </tr>")
end if

'start a new row if needed
if intColPnt = 1 then
Response.Write (" <tr>")
end if

'start a new month cell if needed
if strMonthLog <> strLastMonthLog then
Response.Write (" <td width=""" & intColWidth & """>")
Response.Write (" <table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">")
Response.Write (" <tr>")
Response.Write (" <td colspan=""4"" align=""left"">")
Response.Write (" <br />")
Response.Write (" </td>")
Response.Write (" </tr>")
Response.Write (" <tr>")
Response.Write (" <td colspan=""4"" align=""center"">")
Response.Write (" <font class=""logs_header"">" & strMonthLog &"</font>")
Response.Write (" </td>")
Response.Write (" </tr>")
end if

' log data
Response.Write (" <tr>")
Response.Write (" <td width=""10"" align=""left"">")
Response.Write (" <font class=""text3f""> </font>")
Response.Write (" </td>")
Response.Write (" <td width=""140"" align=""left"">")
Response.Write (" <font class=""text3f"">" & rsVK3PALog("LOG_CALLSIGN") & "</font>")
Response.Write (" </td>")
Response.Write (" <td width=""20"" align=""left"">")
Response.Write (" <font class=""text3f"">" & rsVK3PALog("LOG_YES_NO") & "</font>")
Response.Write (" </td>")
Response.Write (" <td width=""30"" align=""middle"" valign=""center"">")
Response.Write (" <font class=""text3f""><img src=""" & strSiteURL & "/forum/forum_images/icon_smile.gif"" width=""15"" height=""15""> </font>")
Response.Write (" </td>")
Response.Write (" </tr>")

'move column pounter
intColPnt = intColPnt + 1

'refresh last month
strLastMonthLog = strMonthLog

rsVK3PALog.MoveNext

Loop

'close up last cell and row
Response.Write (" </table></td>")
Response.Write (" </tr>")
else
Response.Write ("<tr><td align=""center""><font class=""logs_header"">"No Logs Found</font></td></tr>")
end if

Response.Write ("</table>")
'Reset server objects
rsVK3PALog.Close
Set rsVK3PALog = Nothing
Set adoCon = Nothing
%>
    _-/Cripto9t\-_
Posted
Support Moderator
Doug G
Posts: 6493
6493
http://www.google.com/search?q=ham+radio+logging+software&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
======
Doug G
======
Computer history and help at www.dougscode.com
Posted
Advanced Member
Carefree
Posts: 4224
4224
I'll have to create a database and actually try this, David. I'll have it done today sometime.
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Anyone got any ideas as the tables are not quite going the way that I need them? Many thanks in advance...
Cheers,

David Greening
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
I am still having issues with this if anyone has an idea on how to do it would be fantastic. I have it not showing the 3 columns across but it randomly puts coloums be it 3 or 1, but very random.
Cheers,

David Greening
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
I ended up getting this working the way my father needed... Thanks for the input.
Cheers,

David Greening
 
You Must enter a message