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

Accessing a report without being logged in?

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

    Accessing a report without being logged in?

    Hello,

    I am trying to access a report that alpha anywhere generates through a regular URL. How would I do that?

    Looking through the browser's network tab I see that an AJAX call gets made to http://mysite/Return%20Shipper.a5rpt (that's the name of the report) with a bunch of options and then the response that the app gets is a URI of where the temporarily generated file is located. How can I set the options so that the report has a standard URI?

    What I'd like to do:

    A browser request to http://mysite/Return%20Shipper.a5rpt?<sanitized sql options here> results in the server responding with a file download.

    Thanks,

    GP
    Last edited by GP-FBD; 02-16-2018, 07:42 PM.

    #2
    Re: Accessing a report without being logged in?

    Gary

    One way this can be done.

    create a new a5w page and in the source of the page put code to handle the request to the webpage.

    for example create a5w page called ShipperRpt. Set the security of the page to always allow if security is used within project.

    The easiest way is to create and call a page like http://mysite/ShipperRpt.a5w?arg1=1&arg2=1&pass=239874

    Essentially you will create an api to generate a report

    The Following code goes into the a5w page (Delete Everything else obviously leave the opening and closing tags of <%a5 ... %>

    on error goto error_handler

    DIM arg1 as n = Context.Request.QueryString.Get("arg1") 'example with url ?arg1=1
    DIM arg2 as n = Context.Request.QueryString.Get("arg2") 'example with url ?arg2=1
    DIM Pass as n = Context.Request.QueryString.Get("pass")

    'Probably want to write some further validation code

    if Pass = 239874 then
    DIM args as SQL::Arguments
    args.add("arg1",arg1)
    args.add("arg2",arg2)

    DIM filename as c
    filename = file.temp_path_get()+remspecial(convert_type(*guid_create(),"c"))+".pdf"

    a5w_report_saveAs("[path of report]Shipper.a5rpt","PDF","","",filename, null_value(),null_value(),args,null_value())

    ?http_download(filename)

    end
    end if

    end
    error_handler:

    dim er as n = error_code_get()

    dim ert as c = error_text_get(er)

    dim erl as n = error_line_number_get()

    dim escr as c = error_script_get()

    dim erroras as c = er + ert + erl + escr

    ?"Opps Something Went Wrong"

    end

    ** [path of report] with your on path of the report ie "C:\inetpub\App\Shipping.a5rpt" < example of Production location under IIS
    Last edited by alexc; 02-17-2018, 04:25 AM. Reason: Comment at Bottom
    Alex Collier

    "The spread of computers and the Internet will put jobs in two categories. People who tell computers what to do, and people who are told by computers what to do"

    AA Builds from 5221_5152 to Pre-releases >> Deploying to IIS in AWS

    Comment


      #3
      Re: Accessing a report without being logged in?

      Hi Alex,

      Thanks for the help. I think it /almost/ works, except that the http_download function doesn't do quite what I want it to do. Apparently http_download is for downloading things to the server?

      Instead of doing http_download, I've tried to do response.redirect(filename), but that doesn't seem to want to work either :/

      Comment


        #4
        Re: Accessing a report without being logged in?

        It sounds like, then, you want anyone to download any report. If that's the case, then I presume you will have many reports that can be downloaded. So, what you really want is a list of the files that can be downloaded so one can be selected and downloaded.

        If that's all true, then you can give each report a unique name and load them all into the same directory. Then, create an always allowed page and put a grid on it to allow a search. Ours looks like

        rpt_select_grid.png

        Then, the download button opens a window with a UX with a multiselect dropdown box and a button to do the download. Populate the download using filefind.get() to get a list of the files in the directory. Ours looks like

        rpt_down_ux.png

        I should note that we have thousands of projects and thousands of reports, and we have to worry about privacy, so we require a login so we know who is downloading.
        Pat Bremkamp
        MindKicks Consulting

        Comment


          #5
          Re: Accessing a report without being logged in?

          My use case is this:

          We have multiple ruby on rails intranet applications and want to use Alpha Anywhere's report generation engine to generate PDFs. I can programmatically generate the PDF using ruby, but I thought it would be easier to query the alpha anywhere server to dynamically generate a PDF for a specific database record (these are basically 1 page forms) because we have hundreds of a5rpts already created.

          I'd like the experience to be seamless: the RoR page should have a [Download] button which is a link to the internal alpha anywhere server with the record ID being sent as a parameter - and the alpha anywhere server should respond with some data of type application/pdf.

          So far it's been puzzlingly hard to get AA to give me what I want :|

          Gary

          Comment


            #6
            Re: Accessing a report without being logged in?

            After a bit of fiddling I got this "good enough" solution:

            dim reportName as c
            reportName = "<path to .a5rpt>"

            on error goto error_handler
            DIM id as c = Context.Request.QueryString.Get("id")

            if len(id) < 1
            id = "0"
            end if

            DIM filter as c = "id= " + id

            dim options as p
            options.filter = filter

            DIM filename as c
            filename = File.temp_path_get()+remspecial(convert_type(*guid_create(),"c"))+".pdf"
            a5w_report_saveAs(reportName,"PDF","","",filename, null_value(),null_value(),null_value(),options)
            data = File.to_blob(filename)

            Response.Mime_Type = "application/pdf"
            Response.Write(data)

            File.remove(filename)
            end

            error_handler:
            dim er as n = error_code_get()
            dim ert as c = error_text_get(er)
            dim erl as n = error_line_number_get()
            dim escr as c = error_script_get()
            dim erroras as c = er + ert + erl + escr
            ?"Error :" + erroras
            end


            Thanks Alexc!

            Comment


              #7
              Re: Accessing a report without being logged in?

              Awesome work Gary

              Yes you are right i admit the original ?http_download(filename) was a stab in the dark as a was press for time when i wrote the post but i thought at least contribute the code that did work. i had copied the rest of the code from a project, but in my case i actually craft an email to be sent to ensure only the authorised email receipt receives the generated report as an attachment. If your interested in this code as well let me know.

              Your code will come in handy to update and expose this ability in future for me so thanks Gary
              Alex Collier

              "The spread of computers and the Internet will put jobs in two categories. People who tell computers what to do, and people who are told by computers what to do"

              AA Builds from 5221_5152 to Pre-releases >> Deploying to IIS in AWS

              Comment


                #8
                Re: Accessing a report without being logged in?

                You're welcome! I think you helped me more than I helped you :)

                I would probably use SQL::Arguments and modify the definition of the report in order to prevent SQL injection since right now I think someone could do ReportName.a5rpt?id=1;DROP TABLE ReportName; and that would be quite bad.

                Comment

                Working...
                X