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

Printing PDF from Grid

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

    Printing PDF from Grid

    I'm trying to create a .pdf report from a grid.

    My Web Publishing Tutorial book (page 337) shows "Printing a Dialog as PDF," but says nothing about printing from grid components.

    Is it possible to print .pdf's via grid components? And if so, where would I find instructions on doing so?
    Sergeant Richard Hartnett
    Hyattsville City Police Department
    Maryland

    #2
    Rich:

    Depends on what you are doing. Do you want to print a report every time someone hits the submit button? If so you can use the event programming in the grid. I use a menu system that has a report section and all reports are run from there. You could include a dialog component on the page with the grid that has the code to print the report. The dialog also makes it easier to prompt the user for any variable informaiton your report might require. You could also just have a button on your page that prints the report. It all depends on what you want. The actual code to print the report is vey simple. CHeck out the report.saveas command. Hope this helps.

    Steve

    Comment


      #3
      Sorry Steve, I didn't realize there were so many options!

      For now, I'd like to the user to be able to print one or two different reports from the screen, on command, and it sounds like the dialog component is what I'm looking for, but I have very little training in code. If you could maybe show me how to print a simple report, I could more than likely build on that.

      At the moment I have a test grid with a simple test report made. What would I do to create the dialog button that would point to this "test" report and have it print to pdf on the user's screen?

      Any assistance is greatly appreciated.
      Sergeant Richard Hartnett
      Hyattsville City Police Department
      Maryland

      Comment


        #4
        Rich:

        I will be happy to help. Tell me when you want users to run this report. Is it when they are on this page? Have you considered using the new navigation system in V7? You can put a simple menu on each page that could include the reports.

        Steve

        Comment


          #5
          Thanks a bunch.

          Yes I am familiar with the Navagation System, and have acutally used it, but for my current project, it is not necessary.

          I have one particular online form called a "Daily Activity Sheet, which needs to be printed based on the date and officer ID number entered. The online view consists of two grids, linked together.

          The top grid shows the recurring information about that particular day, such as the date, shift worked, weather, etc.

          The second grid shows data that continually changed as the officer responded to calls throughout the shift, so sometimes it has only a few entries and sometimes it has 25 or 30.

          The officers are temporarily printing a web-based view, but of course, it looks like a web view. My goal is to have it print a pre-formatted report, so I really only need one button on the screen that says "Print Report," on the screen that asks them for the date and ID number.

          For what it's worth, I've attached a copy of the current report that the officers print from web view. It doesn't look the way we'd like it to look, but hopefully the pdf version will change all that.
          Sergeant Richard Hartnett
          Hyattsville City Police Department
          Maryland

          Comment


            #6
            Rich:

            Ok - I think I see we you are going. Here is what you need to do first. Design the report as an Alpha report using the desktop tools. Basically, this report is what is presented in a pdf format. Question - when your users log in is the information they print filtered - i.e. specific to each officer? If so, we are going to have to work that filter into the report.saveas command.

            Steve

            Comment


              #7
              Rich:

              I didn't read your response that closely. The best approach is to build a dialog component that will ask for date and badge number. Once that is selected, when they hit submit the report will print. Again, design the report in Alpha then we can proceed to the dialog which will be on the same page as the grid.

              Steve

              Comment


                #8
                Ok, working on it now. Thanks.
                Sergeant Richard Hartnett
                Hyattsville City Police Department
                Maryland

                Comment


                  #9
                  Rich:

                  I didn't read your response that closely. The best approach is to build a dialog component that will ask for date and badge number. Once that is selected, when they hit submit the report will print. Again, design the report in Alpha then we can proceed to the dialog which will be on the same page as the grid.

                  Steve

                  Comment


                    #10
                    Okay Steve, I made a "quicky" report with only some basic information, just so I could learn how to do this. I'll "pretty it up" later.

                    At the moment it does not have any filters, so if printed it would try to print all of the records in the database. I assume we will filter it with the dialog component.

                    Here's what it should look like when printed in pdf. (see attachment)
                    Sergeant Richard Hartnett
                    Hyattsville City Police Department
                    Maryland

                    Comment


                      #11
                      Rich:

                      I am assuming that when your users sign in you are establishing a variable for badge number and date. If this is the case we can easily take those variables and make them part of the filter for the report. Let me know. I am out on a mission and I will check back in two hours. We will get you up and running today with that report.

                      Steve

                      Comment


                        #12
                        Well if you mean when they first login to the program, no, they use a pre-set login name and password.

                        If you mean as they are filling out the Daily Log Sheet, then yes they enter the date and their ID number, and begin filling in events as they happen during the shift.

                        I assume I could just create a "Print Reports" web page, and have the dialog components on that page, unless you know a better method.
                        Sergeant Richard Hartnett
                        Hyattsville City Police Department
                        Maryland

                        Comment


                          #13
                          The report will print everything that is in the table or set associated with its design unless it is filtered. Once your users' data is submitted you could use a dialog component to prompt for id and date if those items are not stored as variables. In that case, build a dialog box that prompts for user id and date and take the resulting variables and built a filter for the report. Below is an example from one of my applications that prompts for a user id and a range of dates. you could easily modify it to include a single date. This code will be put in the validate or after validate section of the dialog component.


                          Code:
                          DIM Cfilter as c
                          cfilter = "update >={" + start_date + "} .and. update <= {" + end_date + "} .and. stud_id = " + std_id
                          report.saveas("prog_report@<adb_path>\jfk_results.dbf","pdf",Cfilter,"",session.session_folder + "\foo.pdf",.f.)
                          
                          response.redirect(session.session_url + "foo.pdf" + time("hms03"))
                          This code sets the filter, opens the report and then opens Adobe to process the resulting PDF file.

                          Steve

                          Comment


                            #14
                            Steve, I'm getting an error message when I try to use the dialog box to print the pdf report.

                            404 Not Found
                            The requested URL /session_folders/e5a94f24ff5e45bcb21690058a84eebf/foo.pdf163219892 was not found on this server.


                            --------------------------------------------------------------------------------

                            Alpha Five/7.0 Build/3906-3009 at SERVER Port 80



                            At first I kept getting a message saying that it couldn't find the start_date or the end_date, so I did away with the calendar and just created a control called "date," which is a textbox. Here's my code. Take a peek and see if you see any obvious problems. Thanks, Rich


                            DIM Cfilter as c
                            cfilter = "update >={" + date + "} .and. update <= {" + date + "} .and. Idno = " + Idno
                            report.saveas("dailylog@<adb_path>\dailylogsheet.dbf","pdf",Cfilter,"",session.session_folder + "\foo.pdf",.f.)

                            response.redirect(session.session_url + "foo.pdf" + time("hms03"))
                            Sergeant Richard Hartnett
                            Hyattsville City Police Department
                            Maryland

                            Comment


                              #15
                              Rich:

                              I would guess the problem is in the filter expression. Update was my field name. Replace this with your field name from the appropriate table.

                              cfilter = "update >={" + date + "} .and. update <= {" + date + "} .and. Idno = " + Idno


                              You are using a single date so make the following change:

                              cfilter= "Your_field_name_holding_date_value = {" + date+ "} .and. Idno = " + idno

                              Also, remember that that the value coming from your control either has to be date type or converted to a date type to make the comparison to the table value.

                              Steve

                              Comment

                              Working...
                              X