Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Send email with ConditionStart & ConditionEnd

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Send email with ConditionStart & ConditionEnd

    GDay all

    I am trying to send an email with repeating sections all now going well although I need to use a5instance1,2 placeholder etc instead of [1],[2] etc placeholder ??? but that is not the question.

    I am trying to conditionally send the repeating section based on the record existing (I am saving qualifications for contractors and some may have no qualifications whilst others may have 10 which are usually a PDF or Word document). Based on this, I am trying to use the ConditionStart & ConditionEnd in the HTML markup of the email. I am also nesting a ConditionStart & ConditionEnd inside the original ConditionStart & ConditionEnd.

    Do I need to have a ConditionStart & ConditionEnd on each line ?
    Is there a way I can suppress blank lines if there is no data or the Condition does not = true ?

    Below is the code I have entered in the WYSIWYG of the Email HTML Editor and below that is what the email is sending through. Record 1 is totally filled out, Record 2 has a {cont_doc_type} of "Other" and Record 3 does not exist.

    ** CODE ENTERED**
    {ConditionStart:other_filename_1:<%a5 isnotblank({cont_doc_type_a5instance1})%>}Document Type: {cont_doc_type_a5instance1}
    {ConditionStart:other_filename_other_1:{cont_doc_type_a5instance1}="Other"} {cont_doc_type_other_a5instance1}{ConditionEnd:other_filename_other_1}
    Filename: {cont_doc_filename_a5instance1}
    Start Date: {cont_doc_start_date_a5instance1} Expiry Date: {cont_doc_end_date_a5instance1} Reminder Date: {cont_doc_reminder_date_a5instance1}{ConditionEnd:other_filename_1}

    {ConditionStart:other_filename_2:<%a5 isnotblank({cont_doc_type_a5instance2})%>}Document Type: {cont_doc_type_a5instance2}
    {ConditionStart:other_filename_other_2:{cont_doc_type_a5instance2}="Other"}{cont_doc_type_other_a5instance2}{ConditionEnd:other_filename_other_2}
    Filename: {cont_doc_filename_a5instance2}
    Start Date: {cont_doc_start_date_a5instance2} Expiry Date: {cont_doc_end_date_a5instance2} Reminder Date: {cont_doc_reminder_date_a5instance2}{ConditionEnd:other_filename_2}

    {ConditionStart:other_filename_3:<%a5 isnotblank({cont_doc_type_a5instance3})%>}Document Type: {cont_doc_type_a5instance3}
    {ConditionStart:other_filename_other_3:{cont_doc_type_a5instance3}="Other"} {cont_doc_type_other_a5instance3}{ConditionEnd:other_filename_other_3}
    Filename: {cont_doc_filename_a5instance3}
    Start Date: {cont_doc_start_date_a5instance3} Expiry Date: {cont_doc_end_date_a5instance3} Reminder Date: {cont_doc_reminder_date_a5instance3}{ConditionEnd:other_filename_3}

    ** EMAIL DATA RECEIVED **
    Document Public Liability

    Filename: Contractor Documents - IMG_5612.JPG
    Start Date: 22/10/2014 Expiry Date: 28/10/2014 Reminder Date: 28/10/2014


    Test Inputs
    Filename: Y:\CCS\files\contractor\IMG_5487.JPG
    Start Date: 08/10/2014 Expiry Date: 23/10/2014 Reminder Date: 23/10/2014

    Filename:
    Start Date: Expiry Date: Reminder Date:

    Any advise would help and I hope this makes sense.

    Cheers
    Paul

    #2
    Re: Send email with ConditionStart &amp; ConditionEnd

    If anyone was lost like me, this feature is in a UX component as an onClick Action Javascript titled "Send Email", and then the Message Body (HTML). You can insert a command such as "conditional section". Or alternately, the email can be from a template in the Repository under Project Properties. Ten years and I am still finding new stuff.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Send email with ConditionStart &amp; ConditionEnd

      Thanks Steve, I was totally lost and now looking into that feature.

      Sorry Paul, I have nothing to say about your issue, but looking forward to others replies.
      Edhy Rijo
      Progytech
      (Computer Consultants)
      The makers of CardTracking.Net
      www.progytech.com

      Comment


        #4
        Re: Send email with ConditionStart &amp; ConditionEnd

        Gday all
        Really should proof read my posts :) !!!
        I have recorded a Screencast in order to make it a easier to understand what I am trying to achieve and if anyone can help.
        Thanks in advance
        http://www.screencast.com/t/JUE7WBOAl

        Comment


          #5
          Re: Send email with ConditionStart &amp; ConditionEnd

          Gday all
          Really should proof read my posts :) !!!
          I have recorded a Screencast in order to make it a easier to understand what I am trying to achieve and if anyone can help.
          Thanks in advance
          http://www.screencast.com/t/JUE7WBOAl[/URL]

          Comment


            #6
            Re: Send email with ConditionStart &amp; ConditionEnd

            Hi Paul,
            Thanks for the video, it does help, unfortunately I have not used ConditionStart/End features and have not idea how to eliminate the blank lines being left by the nested condition
            Code:
            {ConditionStart:other_filename_other_1:{cont_doc_type_a5instance1}="Other"}
            Now, I do have a grid in which users can send emails that will have different subjects and body messages based on fields conditions, I decided to use an xBasics function to handle my conditions and then stored the message bodies in the alpha repository table a5Repository so if I need to change the message body, I can do it in the table without having to re-publish an update to the customer.

            Here is my xb function:
            Code:
            '-- Send notifications email back and fort Providers and BCI from a single button.
            '   We have 4 conditions that may affect where email will be sent and which message
            '   body to use from the a5Repository table using a5w_GetFromWebAppRepository()
            '   I start testing from the last condition
            '   arSigned and work my way back to the first in the nested if...end if below.
            function xbSendEmail as c (e as p)
            	
            	dim fromAddress as c = e._currentRowDataNew.AnnualReportfromReplyToEmail
            	dim fromAlias as c = e._currentRowDataNew.CompanyName
            	dim sendToAddress as c = e._currentRowDataNew.email
            	dim bccAddress as c = e._currentRowDataNew.AnnualReportfromReplyToEmail
            	
            	dim ReportIsDueNow as L = convert_type(e._currentRowDataNew.ReportIsDueNow, "L")
            	dim arReadyForReview as L = convert_type(e._currentRowDataNew.arReadyForReview, "L")
            	dim arReviewCompleted as L = convert_type(e._currentRowDataNew.arReviewCompleted, "L")
            	dim arSigned as L = convert_type(e._currentRowDataNew.arSigned, "L")
            	dim arSignatureDate as d = convert_type(e._currentRowDataNew.arSignatureDate, "d")
            	
            	dim cfpStudentName as c = e._currentRowDataNew.cfpStudentName
            	dim Provider1FullName as c = e._currentRowDataNew.Provider1FullName
            	dim cfpProviderDueDate as d = convert_type(e._currentRowDataNew.cfpProviderDueDate, "d")
            	dim CompanyName as c = e._currentRowDataNew.CompanyName
            	
            	dim emailBodyTemplate as c = ""
            	
            	dim ms as p
            	ms.send_to = sendToAddress
            	ms.send_to_cc = ""
            	ms.send_to_bcc = bccAddress
            	ms.from_email = fromAddress
            
            	'-- Test record flags to build the message parameters from last flag to the first.
            	if arSigned = .T. then
            		'-- eMail sent from Provider
            		ms.subject = "IEP Annual Report for " + cfpStudentName + " - Signed"
            		emailBodyTemplate = a5w_GetFromWebAppRepository("IEP Annual Report - Signed")
            		fromAddress = e._currentRowDataNew.email
            		bccAddress = e._currentRowDataNew.email
            		fromAlias = Provider1FullName
            		sendToAddress = e._currentRowDataNew.AnnualReportfromReplyToEmail
            
            	else
            		if arReviewCompleted = .T. then
            			'-- eMail sent from Company
            			ms.subject = "IEP Annual Report for " + cfpStudentName + " - Review Completed"
            			emailBodyTemplate = a5w_GetFromWebAppRepository("IEP Annual Report - Review  Completed")
            		else
            			if arReadyForReview = .T. then
            				'-- eMail sent from Provider
            				ms.subject = "IEP Annual Report for " + cfpStudentName + " - Ready for Review"
            				emailBodyTemplate = a5w_GetFromWebAppRepository("IEP Annual Report - Ready for Review")
            				fromAddress = e._currentRowDataNew.email
            				bccAddress = e._currentRowDataNew.email
            				fromAlias = Provider1FullName
            				sendToAddress = e._currentRowDataNew.AnnualReportfromReplyToEmail
            			else
            				if ReportIsDueNow = .T. then
            					'-- eMail sent from Company
            					ms.subject = "IEP Annual Report for " + cfpStudentName + " - Due Now"
            					emailBodyTemplate = a5w_GetFromWebAppRepository("IEP Annual Report - Due Now")
            				end if '-- ReportIsDueNow = .T.
            			end if '-- arReadyForReview = .T.
            		end if '-- arReviewCompleted = .T.
            	end if '-- arSigned = .T.
            	
            	'-- Make sure the email body template is evaluated to get the field values
            	'   stored in the template from {} variables.
            	ms.message_html = evaluate_string(emailBodyTemplate)
            	ms.message_text = "Plain text version of the message"
            	
            	'-- No attachements needed by this process.
            	'ms.attachments = "c:\files\mychart1.pdf,c:\files\mytext1.txt"
            
            	'-- If for any reason the a5Repository record does not have a message body template, then
            	'   exit this function.
            	if alltrim(emailBodyTemplate) = "" then
            		'Return a Javascript command
            		xbSendEmail = "alert('The email body is empty.  Email was not sent.');"
            		return
            	end if
            
            	'-- Send email here using Mandrill service.
            	dim pResult as p
            	dim mandrillKey as c = ""
            	pResult = email_send_mandrill(mandrillKey,ms)
            	if pResult.error then
            		xbSendEmail = "alert('There was an error sending your email " + js_escape(pResult.result[1].status) + "');"
            	else
            		xbSendEmail = "alert('Your email was sent successfully to " + js_escape(sendToAddress) + "');"
            	end if
            	
            end function
            Here is a snapshot of my a5Repository table:
            a5Repository.png
            The reason I use the a5Repository table is because it is easier to get or store the record you need using the a5 functions a5w_GetFromWebAppRepository() or a5w_SaveToWebAppRepository().

            Hope this give you some ideas.
            Edhy Rijo
            Progytech
            (Computer Consultants)
            The makers of CardTracking.Net
            www.progytech.com

            Comment


              #7
              Re: Send email with ConditionStart &amp; ConditionEnd

              Hi Edhy
              thanks for the sample and yes, it has given a different approach to customize and sending the correct information based on data entered. I like the idea of the ConditionStart & End and think it gives a great deal of versatility and have tried every possible combination (excluding the correct one !!)

              Thanks again
              Paul

              Comment


                #8
                Re: Send email with ConditionStart &amp; ConditionEnd

                Hi Paul,

                You are welcome, I am glad my sample it giving you some ideas, if you need more info, please let me know.

                Originally posted by paulyp View Post
                I like the idea of the ConditionStart & End and think it gives a great deal of versatility and have tried every possible combination (excluding the correct one !!)
                Yes, I like it too, and normally it will work with simple approaches. I tried it first, but for some weird reason it was not working in my case, so I decided to go the Xbasics route in which I have full control of the situation and easier to copy for another grid or UX control.
                Edhy Rijo
                Progytech
                (Computer Consultants)
                The makers of CardTracking.Net
                www.progytech.com

                Comment

                Working...
                X