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

How to email a report directly from grid

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

    How to email a report directly from grid

    I need to email a report using onclick action of a button on a grid. I have designed the report - do I just add it as an attachment in the 'send email' settings?
    What is the correct syntax for this? Do I need to write an xbasic function to do this?
    I'm trying to incorporate this into an application for a mobile device, so previewing it and/or saving it and sending as an attachment isn't really suitable.
    The report would also need to only include the records having the id in the grid row... although as yet, I haven't been able to get the report to send at all...

    Thanks

    Jonathan

    #2
    Re: How to email a report directly from grid

    Hi Jonathan,
    Make sure your report that you want to use for this works properly with a button all by itself first. Also make sure you can make a button just to send an email with nothing attached. If both work, I can help you get this working when I get in front of my dev computer. I just worked on this myself with some help from another alpha user. It involves a very small xbasic function you need to write and an extra blank field pulled in with your query.

    Comment


      #3
      Re: How to email a report directly from grid

      Originally posted by -Jinx- View Post
      Hi Jonathan,
      Make sure your report that you want to use for this works properly with a button all by itself first. Also make sure you can make a button just to send an email with nothing attached. If both work, I can help you get this working when I get in front of my dev computer. I just worked on this myself with some help from another alpha user. It involves a very small xbasic function you need to write and an extra blank field pulled in with your query.

      I have inserted 2 buttons on the grid - 1 which sends a very simple test email and the other which opens/previews the (filtered) report I need.

      Both operations work fine...its now the function to just email this report directly that I need.

      Thanks

      Comment


        #4
        Re: How to email a report directly from grid

        hello

        yes, you need to write ajax callback function and define all the parameters and use email_send function.
        if you need copy of my function declaration etc., i can attach it.
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


          #5
          Re: How to email a report directly from grid

          OK,
          In your query pull in an extra blank field...something like: '' AS reportfilename.
          Put that blank field in your grid.
          Go into your report button's (your new email button's) onClickEvent and edit your "Open a Report, Label or Letter layout" action
          Change the Target to "Xbasic"
          Under Xbasic function let's just put in "ReportForEmail"
          In DIV Id for progress messages just put in div1 or whatever and then stick "<div id = "div1"></div>" into a freeform edit region...this will show the "working message"
          Now go to your xbasic functions area and put in the code:
          Code:
          function ReportForEmail as c (e as p)
          
          dim reportName as C
          dim ajaxResponse as C                
                          session.fileName=e.reportFilename
                          ajaxResponse="{grid.object}.setValue('D','REPORTFILENAME','"+js_escape(session.fileName)+"');"
                          reportForEmail=ajaxResponse
          end function
          You will see I have 'D' as I'm doing this from the detail view and you will also see my blank field in there where I'm going to stick the filename for my report.

          Next go to that blank field you brought in and edit it's onChangeEvent.
          Add a new action and pick "Send Email"
          Put all the normal stuff in there and then under "Attachments" stick in: {session.fileName} Which is the filename made in the xbasic function.

          I'm sure there are other ways to do this but this seemed most simple to me at the time. Also, you now have that filename availlable in your grid field if you need it for something else. You can hide that grid field after you're sure everything is working right.

          Hope this helps!
          Last edited by -Jinx-; 02-08-2013, 12:35 PM.

          Comment


            #6
            Re: How to email a report directly from grid

            Hello,

            Tried to follow this but I'm getting an error. Didn't but the Div tag don't see where to put this. I have a table that I added the ReportFileName field too and added it to the grid. Any help is appreciated.

            Thanks



            If I leave the default function in I get this error.
            Fatal Error: Could not compile Xbasic: 'serverside_1cc269174af8472aa4bae2464f47021c'.

            If I comment out the function serverside_1cc269174af8472aa4bae2464f47021c as c (e as p) I get this.
            Error executing Ajax callback function 'serverside_1cc269174af8472aa4bae2464f47021c'. Error reported was: Function: 'serverside_1cc269174af8472aa4bae2464f47021c' was not recognized

            Comment


              #7
              Re: How to email a report directly from grid

              Fatal Error: Could not compile Xbasic: 'serverside_1cc269174af8472aa4bae2464f47021c'.
              i do not know how you got this.
              create a report the way you want it first.
              then add a button in the grid that calls ajax callback function name that function something like send_email and ask alpha to create function prototype for you.
              then open the xbasic function on the left hand side and write your code in that prototype to send email.
              the e object will have all the necessary data available for you to use in your function
              attach the report as email attachment.
              you are set to go
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment


                #8
                Re: How to email a report directly from grid

                Hi Thanks

                Just realized I put it in the wrong place.

                Thanks for your speedy response.

                Comment


                  #9
                  Re: How to email a report directly from grid

                  Got it working thanks.

                  Comment


                    #10
                    Re: How to email a report directly from grid

                    OK,
                    In your query pull in an extra blank field...something like: '' AS reportfilename.
                    Put that blank field in your grid.
                    So I create a field in my table, named "reportfilename" refreshed my grid and inserted the field into my grid. I changed the onchange event and the div1 fires showing the working message.


                    Still not working for me though. I can send an email and I can print the report, I just can't send the report as an email.
                    Not sure what to do...any advice on setup here would be mucho appreciated
                    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                    Comment


                      #11
                      Re: How to email a report directly from grid

                      Originally posted by CharlesParker View Post
                      So I create a field in my table, named "reportfilename" refreshed my grid and inserted the field into my grid. I changed the onchange event and the div1 fires showing the working message.


                      Still not working for me though. I can send an email and I can print the report, I just can't send the report as an email.
                      Not sure what to do...any advice on setup here would be mucho appreciated
                      OK,

                      So, you've created a button that has action javascript to "Open a Report, Label or Letter Layout". Inside that action, under "Target Window. DIV. Tabbed UI Pane or Panel" you should have set the target to "Xbasic" and the Xbasic function to your function; in my case, "reportForEmail". Then the DIV ID for progress messages is set to div1.

                      My Xbasic function then, looks something like this:
                      Code:
                      function reportForEmail as c (e as p)
                      
                      dim reportName as C
                      dim ajaxResponse as C          
                                      session.fileName=e.reportFilename
                                      ajaxResponse="{grid.object}.setValue('D','REPORTFILENAME','"+js_escape(session.fileName)+"');"
                                      reportForEmail=ajaxResponse
                      end function
                      You can see that in the code, I send back the javascript to set my 'ReportFileName' field's value to the file name of the report created by the xBasic function. My 'ReportFileName' field happens to be in the detail view, hence the 'D'.

                      In my 'ReportFileName' field, I have the "Send Email" action javascript in the OnChange event, so when my Xbasic above sends back the javascript and sets the value, the OnChange event fires and sends the email.

                      Inside my "send email" action javascript I have "Attachments" set to {session.fileName} which is the file created by the "Open a Report, Label or Letter Layout" action.



                      I'm sure you just must be missing one of these steps above. Most likely the last one. Hopefully this get's you on the right track. On another note, there may be a better way to do this at this time. There are definitely easier ways if you just use custom code throughout. However, this was the easiest way I could find using an absolute minimum of custom code at the time.

                      Comment


                        #12
                        Re: How to email a report directly from grid

                        How does alpha know what e.reportfilename is?
                        should it be e.lt_freeforminvoice1@alpha5_123.alb ? also if that is the case I am also using a SQL filter in the report print genie so I am not sure how that works into the equation.
                        To me it seems like the report itself should have all of the sql filtering done prior to calling it


                        I am certain the on change event fires as the correct div pops up saying working...
                        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                        Comment


                          #13
                          Re: How to email a report directly from grid

                          Originally posted by CharlesParker View Post
                          How does alpha know what e.reportfilename is?
                          should it be e.lt_freeforminvoice1@alpha5_123.alb ? also if that is the case I am also using a SQL filter in the report print genie so I am not sure how that works into the equation.
                          To me it seems like the report itself should have all of the sql filtering done prior to calling it


                          I am certain the on change event fires as the correct div pops up saying working...
                          Because e.reportfilename is part of the e object created by alpha.

                          Put a debug(1) in your Xbasic function code and you'll see it.
                          de.png

                          I'm using a sql filter in the report as well.

                          rpt.png

                          Comment


                            #14
                            Re: How to email a report directly from grid

                            hmm, now I am really stumped and will go back over the process again. I cannot see where I am doing something different than you. I do have the latest build. Are you working in 11?
                            NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                            Comment


                              #15
                              Re: How to email a report directly from grid

                              I'm on 2399_4531 of Alpha Anywhere. I haven't had a chance to upgrade to 2446_4365 as of yet.

                              Comment

                              Working...
                              X