Sam Laundon Posted January 31, 2007 Posted January 31, 2007 Please help a dyslexic with this issue: Problem - I have three tables, email table, leads table and leads newsletter table. The leads table is a portal in the email table. The script action is to go to the first row of the leads portal and send an email, than go to the leads newsletter table and create a record, than return to the leads table and go to the next row and repeat the process. I have been able to have it all work except the last record in the row is not being acted on. The only way I have been able to make it work is to create a dummy record in the leads table with the highest id number so it is the last record in the portal row. Not the most elegant of solutions. Here is the script: Set Field [ Mass Mail::portal_count_g; 1 ] Loop Go to Portal Row [ Mass Mail::portal_count_g ] Set Field [ leads_find_2::row_number; Mass Mail::portal_count_g ] Set Field [ Mass Mail::ID_g; leads_find_2::id ] Set Field [ Mass Mail::portal_count_g; leads_find_2::row_number ] Set Field [ leads_find_2::newsletter; Mass Mail::Newsletter title ] Set Field [ Settings::Results; Settings::Results & "¶¶" & Set Field [ leads_find_2::Results; SMTPit_Send & "¶" & Set Field [ Mass Mail::portal_count_g; leads_find_2::row_number + 1 ] Perform Script [ "New Record Leads Newsletter" ](this is where the new record in the leads newsletter table is created) Exit Loop If [ leads_find_2::count_dr= Mass Mail::portal_count_g ] End Loop Thanks in advance for your help - Sam
sbg2 Posted January 31, 2007 Posted January 31, 2007 Set Field [ Mass Mail::portal_count_g; leads_find_2::row_number + 1 ] Perform Script [ "New Record Leads Newsletter" ](this is where the new record in the leads newsletter table is created) Exit Loop If [ leads_find_2::count_dr= Mass Mail::portal_count_g ] It looks like your Exit If is set to exit the loop before the last row. Try putting the Set Field [ Mass Mail::portal_count_g; leads_find_2::row_number + 1 ] step after the Exit If.
Sam Laundon Posted January 31, 2007 Author Posted January 31, 2007 Thanks for trying to help sb2, but your solution did not work. The script got hung up on row two and kept sending emails and creating new records for the 2nd row.
Inky Phil Posted January 31, 2007 Posted January 31, 2007 Hi Sam I would approach this in a slightly different way. My script would go something like this: Go to portal row last Set Field [counter; Get(PortalRowNumber) ] Go to Portal row first Loop do whatever you want go to portal row next setfield(counter;counter-1) exit loop if counter=0 endloop That way the counter will be set to the number of rows on the portal and your loop will only exit once you have dealt with the last row HTH Phil
Sam Laundon Posted February 1, 2007 Author Posted February 1, 2007 Thank you so much Phil. Your way worked perfectly. All the best - Sam
Recommended Posts
This topic is 6507 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now