Author |
Topic  |
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 12 June 2007 : 14:55:23
|
Thanks! |
 |
|
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 12 June 2007 : 15:08:23
|
Well, in light of the e-mail that I sent to you where do you think I should head now? |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 12 June 2007 : 15:22:48
|
You could probably add a newsletter_sent field to the members table and set it to 0. Whenever a new newsletter is to be sent, get the fist 100 records, send the email, update the newsletter_sent for those members to the previous to 1. Then get the next 100 for which the field is not 1, send the emails, update the field, and so on, until you have no more members to send. You can then set the field back to 0, just to be ready for the next newsletter. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
 |
|
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 12 June 2007 : 15:35:01
|
I am pretty sure I understand. So the initial query (for selecting the second group) would go something like this for each member who wants the newsletter:
SELECT * FROM ( SELECT TOP 100 MEMBER_ID FROM (SELECT TOP 200 MEMBER_ID FROM FORUM_MEMBERS AS NEXT_200_MEMBERS WHERE M_NEWSLETTER_SENT = 0 ORDER BY MEMBER_ID) AS FORUM_MEMBERS ORDER BY MEMBER_ID DESC ) As T2 Order by MEMBER_ID ASC
And then after the script was finished with all of the batches of 100, it could do an update query and set the field back to 0 for all members who wanted the newsletter, right?
Ok, I need to automate this, while I have your keyboard (with fingers attached ), can I ask you how to automate it between batches ... say at 120 seconds?
Thanks Rui as always!
|
Edited by - Etymon on 12 June 2007 15:46:25 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 12 June 2007 : 16:01:25
|
LOL! Well, I guess I am not understanding then. 
I'm eventually going to be selecting 4,000 members spaced at 120 seconds apart.
Wouldn't I do this:
SELECT TOP 100 MEMBER_ID FROM FORUM_MEMBERS AS FIRST_100_MEMBERS WHERE M_NEWSLETTER_SENT = 0 ORDER BY MEMBER_ID
Then send the mail out ...
... then do an update setting that group to a 1. After that, start with the second group, do the same, and continue until finished, and finally upon completion of everything set M_NEWSLETTER_SENT back to 0 for everyone? |
Edited by - Etymon on 12 June 2007 16:04:30 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 12 June 2007 : 16:34:39
|
Whew! Now I have to go on with the timing issue! LOL! Thanks so much, Rui! |
 |
|
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 15 June 2007 : 21:23:04
|
OK, Rui. 
I found a timer. I think. LOL!
Here's where I got it from: (http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar06/hey0330.mspx)
Here's the code for it though it only seems to work in Internet Explorer though I only need it to work in IE, so that's a good thing, huh? 
<script language = "VBScript">
Dim dtmStartTime
Sub Test
dtmStartTime = Now
idTimer = window.setTimeout("PausedSection", 5000, "VBScript")
End Sub
Sub PausedSection
Msgbox dtmStartTime & vbCrLf & Now
window.clearTimeout(idTimer)
End Sub
</script>
<body>
<input id=runbutton type="button" value="Run Button" onClick="Test">
</body> |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 17 June 2007 : 11:05:24
|
vbscript will only work in ie, you're right. Personally I'd be wary of using client-scripted timing loops to do stuff on the server, but I haven't got your full architecture - just beware that it may get you into a muddle thoguh |
 |
|
Etymon
Advanced Member
    
United States
2395 Posts |
Posted - 18 June 2007 : 16:18:27
|
It's for an admin page, so IE is ok. I'll take your advice under council. Thanks!  |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 19 June 2007 : 12:50:47
|
cool :) |
 |
|
Topic  |
|