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

Email reports based on grouping

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

    Email reports based on grouping

    I would like to email a report that I created. The report is grouped by account number. What I want is to email each group to a specific email address (the directors in charge of the account), how can I do that?

    The report will be printed in a pdf format. At the moment I print each report to pdf and email it from the pdf which is very cumbersome and time consuming. Can I use a script?

    Thanks

    Thanks

    #2
    Re: Email reports based on grouping

    I did this in Access and here is the code that I used. See below:

    Private Sub cmdEmail_Click() 'RTIG DEPT
    On Error GoTo Err_cmdEmail_Click
    If IsNull(Me.cboMonthDD.Column(1)) Or Me.cboMonthDD.Column(1) = "" Then
    Exit Sub
    Else
    DoCmd.RunMacro "Advanc_Services_200043"
    End If
    Exit_cmdEmail_Click:
    Exit Sub

    Err_cmdEmail_Click:
    MsgBox Err.Description
    Resume Exit_cmdEmail_Click

    =======================

    The Macro run the email object that has the usual "To", "From" etc Unfortunately I dont know how to do this in Alpha. Maybe this will help in someone giving me the heads up.

    Thanks

    Comment


      #3
      Re: Email reports based on grouping

      Disregard this posting, my IT people will not allow POP email configuration, we are using Exhange server and I dont know any way to go around this. I have figured how to do the report by parameter but the email will not go because of this.

      Thanks for everything. Does anyone has any ideas. I dont want to go the gmail way because of the sensitivity of the reports.

      Thanks again,

      Comment


        #4
        Re: Email reports based on grouping

        Hello K,

        Take a look at the attached JPG. To give you some ideas.

        We use Exchange Server at work, and of course Outlook is our default email program.

        I Outlook all the time for sending PDF files.

        Regards

        Ed

        Comment


          #5
          Re: Email reports based on grouping

          Thanks Ed,

          With your help I have been able to set the email thru Outlook, ehhh had a slight pdf driver issues but that was resolved right away when the admin installed them for me. Its working at the moment but I dont know if I should have opened a new posting on this. The Xbasic below is what is running the parameter driven based on "costctr" to create the report in pdf format and email it to the right email address, which I manually do now.

          Is there anyway I can automate this by inserting the email and associated "costctr" in this code so that it will run with the click of a button?

          For instance [email protected] will be connected to costctr 200500 and so forth for all costctrs and emails associated with them, all hardcoded in the Xbasic code. I will love to do this but I dont know where in the code to insert this. Should I use a table with 2 fields, field1 (email address) and field2 (Costctr) and get the system to look at the table fields and go down each record and insert the information in the costctr and email "to" fields in this code.

          I am open to any advice.

          Thanks



          ==============================================
          'Send a report, label, letter, form or browse layout as an attachment to an e-mail message. You can specify which records to send.

          filter = " (Costctr = [varC->prms.Parameter1] )"
          get_parameters_string = <<%string%
          Parameter1|Costctr|Character|text box||
          %string%
          ok_label = "&OK"
          cancel_label = "&Cancel"
          dialog_title = "Parameters"

          'Prompt for parameter values. Store results in a 'dot' variable called 'prms'
          dim prms as p
          prms = ui_get_parameters(dialog_title,get_parameters_string,ok_label,cancel_label)

          if prms.last_button_pressed = "OK" then
          'Replace parameters in the filter with actual values
          query.filter = replace_parameters(filter,local_variables())

          query.order = "Phone_num"
          else
          end
          end if

          to_param = a5_eval_expression("",local_variables())
          cc_param = a5_eval_expression("",local_variables())
          bcc_param = a5_eval_expression("",local_variables())
          subject_param = a5_eval_expression("",local_variables())
          message_param = a5_eval_expression("",local_variables())


          :Report.Send("telephone_by_month","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)

          Comment


            #6
            Re: Email reports based on grouping

            I have been able to get this to work with the code below. I would like someone to show me how to get the system to pick the "Costctr" and "email address" shown in red from a table called email table with 2 fields i.e "Costctr" and "Emailadd". My reasoning is that I dont want to "hardcode" this into the code thus allowing me to make changes at one table anytime I have to.

            Any help will be appreciated.

            The main table/set name will be telephoneset.

            Thanks

            ==================================================
            'Date Created: 22-Apr-2008 03:13:26 PM
            'Last Updated: 22-Apr-2008 03:21:02 PM
            'Created By : udr
            'Updated By : udr
            'Send a report, label, letter, form or browse layout as an attachment to an e-mail message. You can specify which records to send.

            query.filter = " (Costctr = \"2005AB\" )"
            query.order = ""

            to_param = a5_eval_expression("ev2armtr.com",local_variables())
            cc_param = a5_eval_expression("",local_variables())
            bcc_param = a5_eval_expression("",local_variables())
            subject_param = a5_eval_expression("Telephone",local_variables())
            message_param = a5_eval_expression("Testing",local_variables())


            :Report.Send("telephone_by_month","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)
            ;

            query.filter = " (Costctr = \"2005AC\" )"
            query.order = ""

            to_param = a5_eval_expression("[email protected]",local_variables())
            cc_param = a5_eval_expression("",local_variables())
            bcc_param = a5_eval_expression("",local_variables())
            subject_param = a5_eval_expression("Telephone",local_variables())
            message_param = a5_eval_expression("Testing",local_variables())


            :Report.Send("telephone_by_month","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)

            Comment


              #7
              Re: Email reports based on grouping

              To process all records in the email table table...

              Code:
              tbl = table.open("email table")
              'if running from a form where the email table is a child of the set use
              'tbl = table.current(#)
              'instead of the first line above
              'where # is the position from the top of the set structure counting down, parent table as 1
              tbl.fetch_first()
              
              while .not. tbl.fetch_eof()
              	
              query.filter = "Costctr = "+quote(tbl.costctr))
              query.order = ""
              
              to_param = a5_eval_expression(alltrim(tbl.Emailadd),local_variables())
              cc_param = a5_eval_expression("",local_variables())
              bcc_param = a5_eval_expression("",local_variables()) 
              subject_param = a5_eval_expression("Telephone",local_variables()) 
              message_param = a5_eval_expression("Testing",local_variables())
              
              :Report.Send("telephone_by_month","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)
              
              tbl.fetch_next()
              end while
              'if using table.current() above, don't close table per next line
              tbl.close()
              Last edited by Stan Mathews; 04-23-2008, 11:29 AM. Reason: trimmed the email address - alltrim(tbl.Emailadd)
              There can be only one.

              Comment


                #8
                Re: Email reports based on grouping

                Hi Stan,

                Thanks for coming to my aid.
                I applied your method but unfortunately I am getting a incorrect datatype on line 12. See below

                ==================
                'Date Created: 22-Apr-2008 03:13:26 PM
                'Last Updated: 23-Apr-2008 12:21:48 PM
                'Created By : udr
                'Updated By : udr
                'Send a report, label, letter, form or browse layout as an attachment to an e-mail message. You can specify which records to send.

                'tbl = table.open("telephone database")
                'if running from a form where the email table is a child of the set use
                tbl = tables_in_set("telephone database_set")
                'instead of the first line above
                'where # is the position from the top of the set structure counting down, parent table as 1
                tbl.fetch_first()

                while .not. tbl.fetch_eof()

                query.filter = ("Costctr = "+quote(tbl.costctr))
                query.order = ""

                to_param = a5_eval_expression(Email,local_variables())
                cc_param = a5_eval_expression("",local_variables())
                bcc_param = a5_eval_expression("",local_variables())
                subject_param = a5_eval_expression("Telephone",local_variables())
                message_param = a5_eval_expression("Testing",local_variables())

                :Report.Send("telephone_by_month","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)

                tbl.fetch_next()
                end while
                'if using table.current() above, don't close table per next line
                tbl.close()

                Comment


                  #9
                  Re: Email reports based on grouping

                  Nerver mind I got it working. Thanks Stan

                  Comment


                    #10
                    Re: Email reports based on grouping

                    Hey K,

                    Gland Stan was able to get you to the end.

                    What made the code work for you, so we all can learn.

                    Regards

                    Ed

                    Comment


                      #11
                      Re: Email reports based on grouping

                      Since I was using the table set I should have used this 'tbl = table.current(#)instead of this tbl = tables_in_set("telephone database_set"). I did the change because it was not working at first. My bad.

                      Anyway, I have been able to send my emails to all the directors like I want to and it worked seemlessly like a charm the reports are grouped based on the email table fields costctr and email address.

                      Thanks Stan

                      Comment


                        #12
                        Re: Email reports based on grouping

                        Stan,

                        One quick, quick question, can you put 2 different reports on this code. In other words, the system will run the first one and then run another report right after the first and email the 2 reports on the same email. The filters will be the same.

                        Thanks

                        Comment


                          #13
                          Re: Email reports based on grouping

                          Originally posted by kdankwah View Post
                          In other words, the system will run the first one and then run another report right after the first and email the 2 reports on the same email.
                          No. the report.send() generates the report and sends it immediately. You could have two report.send() statements consecutively but the reports would be sent in separate emails.

                          Code:
                          '.............earlier lines
                          message_param = a5_eval_expression("Testing",local_variables())
                          
                          :Report.Send("telephone_by_month","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)
                          :Report.Send("telephone_by_year","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)
                          tbl.fetch_next()
                          end while
                          To include two reports in one email you will have to report.save_as() for each report, capturing the saved as names, and then send them with FILE.SEND().
                          There can be only one.

                          Comment


                            #14
                            Re: Email reports based on grouping

                            Thanks Stan.

                            Comment

                            Working...
                            X