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

run report from xbasic in a web app.

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

    run report from xbasic in a web app.

    Is it possible to run a report from within an xbasic function in a web app?

    There are commands such as preview_report, but they appear to be for Desktop only.

    Where are the web commands for this?

    #2
    Re: run report from xbasic in a web app.

    Hi Larry,

    When you run a report, as far as I know, it always displays on screen first. The user then has the option to print hard copy, using their own printer controls.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: run report from xbasic in a web app.

      That's fine.

      But what is the xbasic command that will run a report in a web app. (As opposed to putting the report on a button and running it from there.)

      So, for instance, I want to do something like:

      if myvariable = "report1" then
      run_report("report1")
      else
      run_report("report2")
      end if

      I know I can put the report on a button, then fire the button using javascript, but I don't want to have all the extra buttons lying around if I can do without.

      Larry

      Comment


        #4
        Re: run report from xbasic in a web app.

        So really your question is, how can you run a different report based on a value of a variable? You are still going to need a button to trigger the OnPush event.
        Regards
        Keith Hubert
        Alpha Guild Member
        London.
        KHDB Management Systems
        Skype = keith.hubert


        For your day-to-day Needs, you Need an Alpha Database!

        Comment


          #5
          Re: run report from xbasic in a web app.

          Keith,

          I know how to run a report from a button. I also know how to push a button from xbasic.

          So, I could create 10 buttons with 10 different reports and hide them all. Then create a single button that will run all 10 reports based on a variable.

          The single button could call an xbasic script which figures out which of the hidden buttons to run and then "pushes" it. I get how that works.

          What I want to know:

          Instead of having to create 10 hidden buttons to run 10 different reports, is there a way, strictly with an xbasic command, to run a report that isn't being launched from a button - hidden or not.

          There are desktop commands that will run a report if you are using a desktop app - but this is a web app.

          I simply want to know if there is a command similar to

          preview_report("report_name")

          that will work in a web app.

          Comment


            #6
            Re: run report from xbasic in a web app.

            Larry,

            If you don't want a button to run the report, what other event are you thinking of to trigger the code?
            Regards
            Keith Hubert
            Alpha Guild Member
            London.
            KHDB Management Systems
            Skype = keith.hubert


            For your day-to-day Needs, you Need an Alpha Database!

            Comment


              #7
              Re: run report from xbasic in a web app.

              I simply want to know if there is a command similar to

              preview_report("report_name")

              that will work in a web app.
              Not that I'm aware of. You can take the JS code that A5 generates from the button and put it together yourself. I've done that, although it can get to be a real mess depending upon your filtering needs.

              I can't remember if v11 has Action JS in grids. That's the way to do it. Then you can create as many actions as needed and call them however you want. Otherwise, you may be stuck w. the button solution.
              Peter
              AlphaBase Solutions, LLC

              [email protected]
              https://www.alphabasesolutions.com


              Comment


                #8
                Re: run report from xbasic in a web app.

                Ok, I just checked v11. You can't create "portable" action JS commands in grids although you can in a dialog2.
                Peter
                AlphaBase Solutions, LLC

                [email protected]
                https://www.alphabasesolutions.com


                Comment


                  #9
                  Re: run report from xbasic in a web app.

                  Keith - As I explained, I know I have to have some action to trigger the event. What I want is a single button that will allow me to run a single, but variable report, without having to create another button for each report.

                  As I was suspecting and Peter confirmed, there is no easy way to do that.

                  Thank you.

                  Comment


                    #10
                    Re: run report from xbasic in a web app.

                    Why dont you have one button. In that button, simply redirect to an a5w page. Do your xbasic logic within the a5w page.
                    Gary S. Traub, Ph.D.

                    Comment


                      #11
                      Re: run report from xbasic in a web app.

                      Ha ha ha ha - Gary just reminded me. There is an old xbasic way of rendering reports - at least for dbf. Not sure it woks in Sql?

                      e.g.
                      Code:
                      dim filter as c 
                      dim order as c 
                      Dim filename as c 
                      
                      Filter = "Item_Id = " + s_quote(vItem_Id) + vRptFilter
                      Order = "Project_Lineitems->order"
                      
                      filename = session.session_folder + "tempreport.pdf"
                      filename = report.saveas(vReportUse + "@[PathAlias.ADB_Path]\z_project_items.set","pdf",filter,order,filename,.f.)
                      
                      IF file.exists(filename)
                      	currentform.RedirectTarget = session.session_url + "tempreport.pdf?" +  time("hms3")
                      END IF
                      Where vReportUse is a var holding the report name. Not even sure if this method works for dbf in v11?
                      Peter
                      AlphaBase Solutions, LLC

                      [email protected]
                      https://www.alphabasesolutions.com


                      Comment


                        #12
                        Re: run report from xbasic in a web app.

                        Larry,

                        Sure. It is done pretty much like you wrote it in #3 using the "old fashioned" code in Peter's post.

                        This is a little more complex than what you are asking for, because I am printing a bunch of reports, so I have a list of reports in a property array. I'm sure you can simplify it.

                        The array includes RptArray[i].Code where Code is the name of the report created in the Control Panel, RptArray[i].Title is the title of the report so I can put up a message saying "Now printing the Job Status report". RptArray[i].Snooze is some sleep time which varies based on the report to be printed.

                        My test is, are there any records to print? If no, I print a pretty report that says "no issues found". Otherwise, I print the report with a list of issues.

                        vSQL = "SELECT count(1) as StatusCount from v_summary_report where project_number = :argJobno"
                        vStatusCount = crs.data("StatusCount")
                        if RptArray[i].Code = "JobStatus" .and. vStatusCount = 0
                        RptArray[i].Code = "Status2"
                        end if

                        Then I print it to a temporary directory and then to the project directory. The "AppVar.albPath" is the path to the .alb file which I store in the project global variables.

                        dim opts as p
                        opts.filter = "PROJECT_NUMBER = "+Session.JOBNO
                        opts.order = ""
                        dim pdfopts as p

                        vSource = Session.SOURCE + RptArray[vIndx].Code+".pdf"
                        vDestination = Session.DESTINATION + RptArray[vIndx].Code+".pdf"
                        vRprtSaved = a5w_report_saveAs(RptArray[vIndx].Code+"@"+AppVar.albPath,"pdf","","",vSource,global_variables(),pdfopts,args,opts)
                        sleep(RptArray[vIndx].Snooze)
                        file.copy(vRprtSaved,vDestination)
                        Pat Bremkamp
                        MindKicks Consulting

                        Comment


                          #13
                          Re: run report from xbasic in a web app.

                          Hi Pat/Keith/Larry

                          I have been using this thread and chatting with Larry but I don't seem to be able to "get" how to open the PDF once it is saved to disk in the session folders, I can save my report no problem but don't seem to be able to crack how to open the PDF once saved in the same way a button would ...

                          any help much appreciated

                          thanks

                          john

                          Comment


                            #14
                            Re: run report from xbasic in a web app.

                            Hey Miles/John,

                            Did you figure out how to open the saved report PDF?

                            I am trying to get the PDF opened in a preview just like the typical Action Javascript buttons would do.

                            thanks......
                            Andy

                            Comment


                              #15
                              Re: run report from xbasic in a web app.

                              Hi Andy

                              yep we got this going , I will dig out the code and put it on this thread soon as I can

                              cheers

                              john

                              Comment

                              Working...
                              X