close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

repeat region not working in email

Thread began 3/30/2010 11:41 am by brian177569 | Last modified 4/01/2010 5:06 pm by brian177569 | 1736 views | 6 replies

brian177569

rs looping

Hi,

I am using 2 recordsets. here is a typical page without the loop in the body and then a snippet with the loop as a repeat region and then another WA loop. I can get around this with adding the recipients manually with a CC, kinda defeats the object of hooking ap a database!

You can see the 2 recordsets below, rsPTFEenq & rsUsers

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/AsahiGuard.asp" -->
<%
Dim rsPTFEenq__MMColParam
rsPTFEenq__MMColParam = "0"
If (Session("ptfeid") <> "") Then
rsPTFEenq__MMColParam = Session("ptfeid")
End If
%>
<%
Dim rsPTFEenq
Dim rsPTFEenq_numRows

Set rsPTFEenq = Server.CreateObject("ADODB.Recordset")
rsPTFEenq.ActiveConnection = MM_AsahiGuard_STRING
rsPTFEenq.Source = "SELECT * FROM dbo.tblPTFE WHERE intPTFEID = " + Replace(rsPTFEenq__MMColParam, "'", "''") + ""
rsPTFEenq.CursorType = 0
rsPTFEenq.CursorLocation = 2
rsPTFEenq.LockType = 1
rsPTFEenq.Open()

rsPTFEenq_numRows = 0
%>
<%
Dim rsUsers
Dim rsUsers_numRows

Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.ActiveConnection = MM_AsahiGuard_STRING
rsUsers.Source = "SELECT DISTINCT strUsername FROM dbo.tblAGUsers, dbo.tblAGUserProd, dbo.tblCountryProd WHERE dbo.tblAGUsers.intuserID = dbo.tblAGUserProd.intUserID AND dbo.tblAGUserProd.intProdID = dbo.tblCountryProd.intProdID AND dbo.tblCountryProd.intSubProdID = 1"
rsUsers.CursorType = 0
rsUsers.CursorLocation = 2
rsUsers.LockType = 1
rsUsers.Open()

rsUsers_numRows = 0
%>
<!--#include file="WA_Universal_Email/CDONTS_NewMail_VB.asp" -->
<!--#include file="WA_Universal_Email/MailFormatting_VB.asp" -->
<% If rsPTFEenq.Fields.Item("strlang").Value = "Fre" Then
response.Redirect "http://www.agcce.com/french/PTFEenqemail2.asp"
ElseIf rsPTFEenq.Fields.Item("strlang").Value = "Ital" Then
response.Redirect "http://www.agcce.com/italian/PTFEenqemail2.asp"
ElseIf rsPTFEenq.Fields.Item("strlang").Value = "Ger" Then
response.Redirect "http://www.agcce.com/german/PTFEenqemail2.asp"
Else
%>
<%
function WA_Universal_Email_1_SendMail(RecipientEmail)
dim MailObject, MailAttachments, MailBCC, MailCC, MailTo, MailBodyFormat, MailBody, MailImportance, MailFrom, MailSubject
MailAttachments = ""
MailBCC = ""
MailCC = ""
MailTo = ""
MailBodyFormat = ""
MailBody = ""
MailImportance = ""
MailFrom = "AGCCE PTFE web form submission|WA|ptfe@agcce.com"
MailSubject = "PTFE Information Request "

'Global Variables
gAddBCC = ""
gAddCC = ""
gAddRecipient = ""
gBodyFormat = ""
gSetImportance = ""

set WA_MailObject = WAUE_Definition()

if (RecipientEmail <> "") then
set WA_MailObject = WAUE_AddRecipient(WA_MailObject,RecipientEmail)
MailTo = gAddRecipient
gAddRecipient = ""
else
'To Entries
end if

'Attachment Entries

'BCC Entries
MailBCC = gAddBCC

'CC Entries
MailCC = gAddCC

'Character Set

'Body Format
set WA_MailObject = WAUE_BodyFormat(WA_MailObject,0)
MailBodyFormat = gBodyFormat

'Set Importance
set WA_MailObject = WAUE_SetImportance(WA_MailObject,"3")
MailImportance = gSetImportance

'Start Mail Body
MailBody = MailBody & "" & vbCrlf & ""
MailBody = MailBody & "" & vbCrlf & ""
MailBody = MailBody & "<p><span class=" & Chr(34) & "style1" & Chr(34) & ">There is a new PTFE Product Request on the<br />" & vbCrlf & ""
MailBody = MailBody & " AGCCE.com website. Click on the link below to go<br />" & vbCrlf & ""
MailBody = MailBody & " to the Login Page. <br />" & vbCrlf & ""
MailBody = MailBody & " <br />" & vbCrlf & ""
MailBody = MailBody & " Please keep the Request Diary up to date with the <br />" & vbCrlf & ""
MailBody = MailBody & " actions you take on all leads as this will be reported <br />" & vbCrlf & ""
MailBody = MailBody & " on a </span><span class=" & Chr(34) & "style1" & Chr(34) & ">Quarterly </span>basis.</p>" & vbCrlf & ""
MailBody = MailBody & "<table width=" & Chr(34) & "46%" & Chr(34) & " border=" & Chr(34) & "1" & Chr(34) & " cellpadding=" & Chr(34) & "2" & Chr(34) & " cellspacing=" & Chr(34) & "0" & Chr(34) & " bordercolor=" & Chr(34) & "#CCCCCC" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & " <tr>" & vbCrlf & ""
MailBody = MailBody & " <td width=" & Chr(34) & "28%" & Chr(34) & " class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "right" & Chr(34) & ">enquiry date: </div></td>" & vbCrlf & ""
MailBody = MailBody & " <td width=" & Chr(34) & "72%" & Chr(34) & " class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "left" & Chr(34) & ">"
MailBody = MailBody & (rsPTFEenq.Fields.Item("datinsert").Value)
MailBody = MailBody & "</div></td>" & vbCrlf & ""
MailBody = MailBody & " </tr>" & vbCrlf & ""
MailBody = MailBody & " " & vbCrlf & ""
MailBody = MailBody & " <tr>" & vbCrlf & ""
MailBody = MailBody & " <td class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "right" & Chr(34) & ">company: </div></td>" & vbCrlf & ""
MailBody = MailBody & " <td class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "left" & Chr(34) & ">"
MailBody = MailBody & (rsPTFEenq.Fields.Item("strcompany").Value)
MailBody = MailBody & "</div></td>" & vbCrlf & ""
MailBody = MailBody & " </tr>" & vbCrlf & ""
MailBody = MailBody & " <tr>" & vbCrlf & ""
MailBody = MailBody & " <td class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "right" & Chr(34) & ">country:</div></td>" & vbCrlf & ""
MailBody = MailBody & " <td class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "left" & Chr(34) & ">"
MailBody = MailBody & (rsPTFEenq.Fields.Item("strcountry").Value)
MailBody = MailBody & "</div></td>" & vbCrlf & ""
MailBody = MailBody & " </tr>" & vbCrlf & ""
MailBody = MailBody & " " & vbCrlf & ""
MailBody = MailBody & " <tr>" & vbCrlf & ""
MailBody = MailBody & " <td class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "right" & Chr(34) & "></div></td>" & vbCrlf & ""
MailBody = MailBody & " <td class=" & Chr(34) & "style1" & Chr(34) & "><div align=" & Chr(34) & "left" & Chr(34) & "><a href=" & Chr(34) & "http://www.agcce.com/emaillogin.asp" & Chr(34) & ">Visit Login Page to View Request and update Request Diary </a></div></td>" & vbCrlf & ""
MailBody = MailBody & " </tr>" & vbCrlf & ""
MailBody = MailBody & "</table>"
'End Mail Body

set WA_MailObject = WAUE_SendMail(WA_MailObject,MailAttachments,MailBCC,MailCC,MailTo,MailImportance,MailFrom,MailSubject,MailBody)

set WA_MailObject = nothing
end function
%>
<%
if (("" = "")) then
'WA Universal Email object="CDONTS NewMail"
'Send Loop Once Per Entry
while (NOT rsUsers.EOF)
WA_Universal_Email_1_SendMail("" & cStr(rsUsers.Fields.Item("strUsername").Value) & "")
rsUsers.MoveNext()
wend
if (rsUsers.CursorType > 0) then
rsUsers.MoveFirst
else
rsUsers.Requery
end if

'Send Mail All Entries
if ("thanks.asp"<>"") then
Response.Redirect("thanks.asp")
end if
end if
%>
<% End if %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PTFE enquiry email</title>
<style type="text/css">
<!--
.style1 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</head>

<body>
<p>&nbsp;</p>
</body>
</html>
<%
rsPTFEenq.Close()
Set rsPTFEenq = Nothing
%>
<%
rsUsers.Close()
Set rsUsers = Nothing
%>

-- - - - - - - - - - - - - - - - - - - - - - - - - -
WHAT I AM TRYING TO ADD:

This email was sent to:
<table width="46%" border="0" cellspacing="0" cellpadding="2">
<%
While ((Repeat1__numRows <> 0) AND (NOT rsUsers.EOF))
%>
<tr>
<td><%=(rsUsers.Fields.Item("strname").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsUsers.MoveNext()
Wend
%>
</table><br />

OR:

<wa_recordset_loop name="rsUsers">
<tr>
<td><%=(rsUsers.Fields.Item("strname").Value)%></td>
</tr>
</wa_recordset_loop>

Both of the above disable the loop for the send code:

<%
if (("" = "")) then
'WA Universal Email object="CDONTS NewMail"
'Send Loop Once Per Entry
while (NOT rsUsers.EOF)
WA_Universal_Email_1_SendMail("" & cStr(rsUsers.Fields.Item("strUsername").Value) & "")
rsUsers.MoveNext()
wend
if (rsUsers.CursorType > 0) then
rsUsers.MoveFirst
else
rsUsers.Requery
end if

'Send Mail All Entries
if ("thanks.asp"<>"") then
Response.Redirect("thanks.asp")
end if
end if
%>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...