I am trying to simplify my outgoing email routine.
I need to attach a combination of 20 different documents to an outgoing email. Mostly 5 of the documents but hardly ever more than 7.
Currently, I have BO outgoingmail with 20 document attributes and a rule for every attribute (attachment). If I don't want to send that specific document I leave that attachment empty.
This creates every single outgoing email BO with lots of unused attached and every time I add another possible document I need to add an addition attachment attribute. I find this very long-winded and inefficient.
I can select my 5 to 7 documents for the mail to send but how do I get them into say attachment 1 to 7?
I cannot seem to find anything like this on the forums.
Any help will be appreciated.
Tj
Email Attachment loop.
Email Attachment loop.
Tj
Using Version 8.6 Build 2917 - mySQL
Using Version 8.6 Build 2917 - mySQL
Re: Email Attachment loop.
well, you've answered it yourself.
You need to make 1 attachment.
Copy them into a temp physical directory.
Execute a zip.exe to zip that folder into 1 file. Attach only that file & send.
As you've experienced, the existing method is untenable. Best to just invest the time into going the Zip route and the whole process improves.
You need to make 1 attachment.
Copy them into a temp physical directory.
Execute a zip.exe to zip that folder into 1 file. Attach only that file & send.
As you've experienced, the existing method is untenable. Best to just invest the time into going the Zip route and the whole process improves.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Email Attachment loop.
Thanks Jaymer
Not really what I wanted to do as I needed to have attachments as readable separate pdf's
but managed to figure it out ...
FIND Documents IN BATCHES OF 1 (as the loop)
Then use - IF Attachment1 IS UNDEFINED assign it ELSE IF Attachment2 IS UNDEFINED THEN assign it.....up to 7
Not really what I wanted to do as I needed to have attachments as readable separate pdf's
but managed to figure it out ...
FIND Documents IN BATCHES OF 1 (as the loop)
Then use - IF Attachment1 IS UNDEFINED assign it ELSE IF Attachment2 IS UNDEFINED THEN assign it.....up to 7
Tj
Using Version 8.6 Build 2917 - mySQL
Using Version 8.6 Build 2917 - mySQL
-
- Posts: 2400
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Email Attachment loop.
I would do it with a Non Persistant BO.
Will do up a small demo for you tomorrow.
Will do up a small demo for you tomorrow.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
-
- Posts: 1458
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Email Attachment loop.
Non persisted BOs are the neglected superheros of AIM. Will fix all kinds of context issues. They are alleged to make you better looking and able to return the colour to your hair. Allegedly.eagles9999 wrote:I would do it with a Non Persistant BO.
Will do up a small demo for you tomorrow.
-
- Posts: 2400
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Email Attachment loop.
And they can leap tall buildings in a single bound.
Once I discovered them....I use them in so many places....mostly
employing the While Syntax
Once I discovered them....I use them in so many places....mostly
employing the While Syntax
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: Email Attachment loop.
Thanks Mark
Looking forward to getting this one out of my hair!
Looking forward to getting this one out of my hair!
Tj
Using Version 8.6 Build 2917 - mySQL
Using Version 8.6 Build 2917 - mySQL
Re: Email Attachment loop.
I have done something similar to this in several places. But now I do, IMO, something better using EXEC_STRING.Madimant wrote:IF Attachment1 IS UNDEFINED assign it ELSE IF Attachment2 IS UNDEFINED THEN assign it.....up to 7
You will need a new BO with a Plain Text Field and a Number field that has an initial value of 1. This can even be a Non Persistent BO.
Before you find your Documents, CREATE the new BO.
Then set the Plain Text field to:
NewBO.PlainText=`EMail.Attachment`+AS_STRING(NewBO.TheNumber, '#')+`=Documents.Attachment`
NOTE: Use your real BO and attribute names and pay attention to the ' and `
Replace your IF ... ELSE ... with
EXEC_STRING NewBO.PlainText
And add:
INCREASE NewBO.TheNumber BY 1
NewBO.PlainText=`EMail.Attachment`+AS_STRING(NewBO.TheNumber, '#')+`=Documents.Attachment`
The above assumes that all Attachments are UNDEFINED to start with.
If you ever need to increase the number of attachments to your emails, this process will not need to be changed.
Bob
Re: Email Attachment loop.
BobK
Does this approach still need the 20 attachment fields?
And if he finds he needs a 21st, does he, as he said in his post, still have to alter the table to add the 21st?
Does this approach still need the 20 attachment fields?
And if he finds he needs a 21st, does he, as he said in his post, still have to alter the table to add the 21st?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Email Attachment loop.
Yes, he still needs the 20 attachment fields on the outgoing email.Jaymer wrote:BobK
Does this approach still need the 20 attachment fields?
And if he finds he needs a 21st, does he, as he said in his post, still have to alter the table to add the 21st?
If he needs additional attachment fields, he would have to add them to the outgoing email, but my process would not need to be changed. Where as in his current logic he would have to add another ELSE clause to his large If statement.
In summary, After his FIND statement finds X Documents (X being any number less then or equal to the number of Attachment fields on the Outgoing Email) my version of the process will attach each document to a separate attachment field beginning with Attachment1 then Attachment2 and so on until all documents have been processed.
Bob
Re: Email Attachment loop.
Bob, ok, I'm with you.
Anything to make it less Tedious - got it.
Was hoping you'd found some hidden way to not have to physically have 20 fields.
To be clear, you still have 20 Fields ALSO in the Notification, and 20 Rules like below (ie. attach1 thru attach20):
Anything to make it less Tedious - got it.
Was hoping you'd found some hidden way to not have to physically have 20 fields.
To be clear, you still have 20 Fields ALSO in the Notification, and 20 Rules like below (ie. attach1 thru attach20):
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Email Attachment loop.
Actually, I don't think I have ever sent an AwareIM email with an attachment.
You still need the 20 Attachment field on the Notification, but can't you attach the documents directly to the Notification in a Process?
You still need the 20 Attachment field on the Notification, but can't you attach the documents directly to the Notification in a Process?
Bob
Re: Email Attachment loop.
Thank BobK
This is a great way to dynamically put together an BO.attribute...
Something I could never work out before and wanted to do in another section of my program.
There are so many ways to do things in Aware and taping into the wealth of information in the forum is great!
Tj
This is a great way to dynamically put together an BO.attribute...
Something I could never work out before and wanted to do in another section of my program.
There are so many ways to do things in Aware and taping into the wealth of information in the forum is great!
Tj
Tj
Using Version 8.6 Build 2917 - mySQL
Using Version 8.6 Build 2917 - mySQL