|
| |
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
DIM in a DRW - 8/17/2002 18:38:51
Hi All. OK..this works fine. iTest give the correct results.: <!--#include file=" ../_fpclass/fpdbrgn1.inc" --> <% DIM iTest iTest=FP_FieldVal(fp_rs," PromoterEmail" ) %> <%=iTest%> <!--#include file=" ../_fpclass/fpdbrgn2.inc" --> This doesen' t. iTest is only the last record of many: <!--#include file=" ../_fpclass/fpdbrgn1.inc" --> <% DIM iTest iTest=FP_FieldVal(fp_rs," PromoterEmail" ) %> <!--#include file=" ../_fpclass/fpdbrgn2.inc" --> <%=iTest%> Here' s the rub. I need to have iTest outside the DRW. Any ideas. Is this a DRW quirk? Thanks
< Message edited by hzarabet -- 8/16/2002 6:45:29 PM >
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
RE: DIM in a DRW - 8/17/2002 19:15:06
Am I onto something with this? I don' t know how to write iTest=RS(" MailList" ) properly. <% sQry=" SELECT * FROM SHL_Promoters WHERE SHL_Promoters.MailList = ' Y' " Set RS = Conn.Execute(sQry) set rs=nothing Conn.Close Set Conn=nothing DIM iTest iTest=RS(" MailList" ) %>
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
no_mac_jack
Posts: 295 From: Washington state, USA Status: offline
|
RE: DIM in a DRW - 8/17/2002 19:18:52
Oops! You slipped another post in there on me. I' m heading out the door, so I' ll have to look it over later. Sry! Well, you have to realize that your little section of code is in the middle of a loop, so it will repeat for each record returned. In your second piece of code, you' re updating iTest with each record, but you' re only writing it out *outside* the loop, so it will always equal the last value it was set to. FYI - Those two FrontPage include lines are the beginning and end of the loop if that helps you to see why it' s doing that. With that in mind, what exactly are you trying to do? Are you wanting to store all of the Promoter Emails in an array? Print out all of them? I' m not quite seeing what you' re going for. Can you explain a little more? Thx! ~no_mac_jack
< Message edited by no_mac_jack -- 8/16/2002 7:20:06 PM >
|
|
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
RE: DIM in a DRW - 8/17/2002 22:47:25
Spooky, in that example iTest is not carrying the variable through. Spooky...to answer your question (I think), when <%=iTest%> is outside the DRW includes, ONLY the last record of the group appears. When <%=iTest%> is inside the includes, all the results properly appear. Here is a copy of the HTML. Maybe that would explain it clearer than I can.
< Message edited by hzarabet -- 8/16/2002 10:53:35 PM >
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
no_mac_jack
Posts: 295 From: Washington state, USA Status: offline
|
RE: DIM in a DRW - 8/18/2002 0:15:00
So are you only expecting the first query to return one e-mail or several? I think that' s where I' m getting confused, but the example did help. ~no_mac_jack
|
|
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
RE: DIM in a DRW - 8/18/2002 19:59:19
OK. Here we go... 1. I have a table called Promoters. Maybe 600 or so records. Of these 600 promoters, I want to send a mass email to about 300 of them. 2. I have a table called P2P. It contains the text of the message I want to mass mail. On top of that, I am ALSO pulling in information from the above mentioned Promoters table with regards to the individual promoter who is sponsoring the mass email. His email address, phone number, Name, etc. So the CDONTS will contain text from P2P and Promoter information from the Promoters table. I have 2 SQL queries. One is to call the 300 emails from Promoters. The other is an INNER JOIN tying in the promoter info with the text of the message. I was trying to use a DIM with the results of the first query (calling the emails) and place the DIM inside the " To" portion of the CDONTS, attempting to plug in all 300 emails into the " To" . As you know, it didn' t work. So the problem is, I can' t think of a way to do this without using 2 individual SQL queries. And if I use 2 individual SQL queries, I can' t place the DIM in the " To" portion of the CDONTS. Now if all else fails, I can do it the " old fashioned" way and just cut & Paste the 300 emails into the BCC of my Email programs and do it that way instead of with a CDONTS. But, hey, this way is a challenge [:p]
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
no_mac_jack
Posts: 295 From: Washington state, USA Status: offline
|
RE: DIM in a DRW - 8/18/2002 23:53:50
Tell me if this is any closer... You want to call the list of e-mail addresses from the SHL_Promoters table *once* and then use the DRW region to fill out one or more e-mails which would be sent to everyone from the first query. Am I on the right track? If you' re pulling a bunch of addresses from the promoters table, do something like this to grab them all at once and stuff them into an array which we can use later...
<%
Dim connDB, strSQL, objRS
set connDB = Server.CreateObject(" ADODB.Connection" )
connDB.open ' ' put your connection information here
strSQL = " SELECT * FROM SHL_Promoters WHERE SHL_Promoters.MailList = ' Y' "
set objRS = connDB.execute(strSQL)
Dim arrAddresses
If objRS.BOF AND objRS.EOF Then
Response.Write " Query #1 failed."
objRS.close
set objRS = nothing
connDB.close
set connDB = nothing
Response.End
Else
arrAddresses = objRS.GetRows()
End If
objRS.close
set objRS = nothing
connDB.close
set connDB = nothing
%>
For more info on using GetRows() to store DB info in an array, see this ASPFAQ Now you have those e-mail addresses in an array (actually, a two-dimensional array, to be exact). You can write them out like this...
Dim iCount
For iCount = 0 to UBound(arrAddresses)
Response.Write arrAddresses(0,iCount)
Next Granted, my syntax is likely completely out of whack, but it' s just meant to show that it can be done. I haven' t actually coded in ASP for over a year, so I' m a bit rusty. Anyway, I' m hoping that this will at least be close to what you' re after. Let us know... ~no_mac_jack BTW- You keep talking about wanting to put a Dim in the " To" field of the CDONTS mail, but the Dim statement is just a way of declaring variables.
|
|
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
RE: DIM in a DRW - 8/21/2002 12:59:32
So the questions are now... 1. How do I get the results from the MailList column to be pulled in instead of the index ID number column 2. Get rid of this error messafe: Subscript out of range: ' 7' The ' 7' relates to the number of results of the query. If I had 12 results then Subscript out of range: ' 12' shows up. Thanks again all. I am close (I think)
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
no_mac_jack
Posts: 295 From: Washington state, USA Status: offline
|
RE: DIM in a DRW - 8/21/2002 17:08:56
Yay! Now, to get it to set those as the " To" for your CDONTS mail, try the code below. It doesn' t seem very efficient, but I don' t think CDONTS lets you do anything like the AddRecipient in ASPMail. Give it a shot... Dim iCount, strTo
For iCount = 0 to UBound(arrAddresses,2)
strTo = strTo & arrAddresses(0,iCount) & " ;"
Next
MyCDONTSMail.To = strTo Now, if you wanted, I would guess that you could use your address as the " To" and then do MyCDONTSMail.Bcc = strTo so that they can' t see everyone else' s addresses when you send it. Anyway, that should work. If you want to learn why the GetRows part worked, I would go to that ASP FAQ that I linked to a couple of posts back. It also has a link to Charles Carrol' s page about GetRows and how it' s more efficient than looping through the recordset. That UBound code on the loop tells it to stop the loop once the counter has reached the total number of addresses in the array. The code I left out tells it which dimension of the array to count. Probably gibberish, but with that Wrox book and the link I gave you, it will hopefully become a little more clear. Hope that works! ~no_mac_jack
|
|
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
RE: DIM in a DRW - 8/23/2002 16:16:22
Works great NMJ!! Thank you again. Do I have this straight?.... GetRows() is sort of like a giant claw that holds a group of records at one time.... The 2 in " For iCount = 0 to UBound(arrAddresses, 2)" signifies we are counting until the last ROW. If that were a 1 instead it would count until the last COLUMN... Once again...bless you all for your patience with a comparative simpleton [:p]
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
hzarabet
Posts: 1539 From: New Milford CT USA Status: offline
|
RE: DIM in a DRW - 8/24/2002 16:57:08
Spooky...you should give out Gold Stars!!!! Thanks again NMJ for you patience!
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|