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

Save Report

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

  • Save Report

    Hi

    I have been trying to get this to work all day now and have now gave up and am turning to the trusted message board for assistance. :)

    I am trying to save a report to a local drive on my machine, the report runs fine if I use "open a report" action javascript but when trying to save a report using the same report with the following code nothing happens.



    Dim filename as c = "Additionals_"+session.report_no+".pdf"
    Dim filepath as c = "G:\Additionals"+chr(92)+filename

    dim args as sql::Arguments
    dim Options as p
    dim printOptions as p
    args.set("blank", "")
    options.propogateErrors = .t.
    printOptions.blank = ""
    'Dim reportname as c = a5_removetrailingbackslash(request.applicationRoot) +"\additionals_auth.a5rpt"
    Dim reportname as c = "[email protected]"
    Dim saveAs as c = "PDF"
    Dim filter as c = "REPORT_NO = "+val(session.report_no)
    Dim order as c = ""

    fn = a5w_report_saveAs(reportName,saveAs,filter,order,filepath,global_variables(),printOptions,args,options)


    Could anyone perhaps advise me where I am going wrong

    Your help would be appreciated.

    Thank you

    Peter

  • #2
    Re: Save Report

    Couple ideas. Try
    Dim filename as c = "Additionals_"+session.report_no
    that is, without the .pdf.

    Also, after you print it, you can copy it anywhere you want
    sleep(3) 'give it time to print
    new_path_and_name = "g:\Additionals"+chr(92)+filename+".pdf"
    file.copy(fn,new_path_and_name)
    Pat Bremkamp
    MindKicks Consulting

    Comment


    • #3
      Re: Save Report

      Hi Pat

      Thanks for that.

      At least I am now getting somewhere.

      I am now getting the error:

      Invalid report filter expression: 'additionals_header.report_no = adir-49268'.

      With this code:

      Dim filename as c = "Additionals_"+session.report_no
      Dim filepath as c = "G:\Additionals"+chr(92)

      dim args as sql::Arguments
      dim Options as p
      dim printOptions as p
      args.set("Blank", "")
      options.propogateErrors = .t.
      printOptions.blank = ""
      Dim reportname as c = "[email protected][PathAlias.ADB_Path]\pcss.alb"
      Dim saveAs as c = "PDF"
      Dim filter as c = "additionals_header.report_no = "+session.report_no
      Dim order as c = ""

      fn = a5w_report_saveAs(reportName,saveAs,filter,order,filepath,global_variables(),printOptions,args,options)

      I am not sure where I am going wrong with the filter.

      Comment


      • #4
        Re: Save Report

        common problem...try
        Dim filter as c = "additionals_header.report_no = \""+session.report_no+"\""

        Without the quotes, Alpha sees adir-49268 as a variable, not a value. For sql backend you may need ' instead of "
        Pat Bremkamp
        MindKicks Consulting

        Comment


        • #5
          Re: Save Report

          Hi

          Sorry for my delay in replying but have been busy with other urgent things and never got round to fixing this problem.

          I have at the moment managed to get my report to save to the harddrive but all my reports are showing 'Report does not contain any records' I suspect it is my filter.

          My filter is currently:

          Dim report_number as c = session.report_no
          Dim filter as c = "report_no = \""+report_number+"\""

          I am unsure where I am going wrong now.

          Any help would be greatly appreciated.

          Comment


          • #6
            Re: Save Report

            Hi,

            Suppose your sql definition is domething like: select * from additionals_header

            What does
            select * from additionals_header
            where additionals_header.report_no = session.report_no

            directly submitted in an sql query tool give as result?

            session.report_no is that numerical or not?

            You better use an argument
            either
            set.args("whatreport_no",session.report_no) or set.args("whatreport_no",convert_type(session.report_no,"N"))

            filter = "additionals_header.report_no = :whatsession.report_no "


            compare to my code you have no
            options.filter = Filter



            Creating an report an directly downloading I have done some cutting and pasting in my code but maybe you can see where yours goes wrong:
            This works for me:
            function Create_xls as c (e as p)
            'create a sql arguments object
            dim args as sql::arguments
            args.set("whatcentra_kode",e.datasubmitted.veldcentra_kode)
            args.set("whatpeildatum",convert_type(e.datasubmitted.veld_peildatum,"D"))
            args.set("whatuser",a5ws_getcurrentuser())

            'We open a connection and get the single fields
            Dim cn as sql::connection
            dim flag as l
            flag = a5SQLConnectionOpen(cn,"::name::dataPieterOntwikkeling", session)
            if flag = .f. then
            dim msg as c
            msg = "Could not connect to database. Error reported was: " + cn.CallResult.text
            'we need to encode this for javascript since the message will be sent back to the browser for display
            'js_escape() encodes ' as \' and crlf as \n
            msg = js_escape(msg)
            dim jscmd as c
            jscmd = "alert('" + msg + "');"
            Create_xls = jscmd
            exit function
            end if
            'The base sqlselect is based on the selected report
            ' ___where___ is the variabele where part
            ' ___group_by___ is the variable group by part
            dim strrapport as c = upper(e.datasubmitted.veldrapport)
            dim strgroupby as c 'replaces ___groupby___
            dim strwhere as c 'replaces ___where___
            dim strselect as c 'replaces ___select___
            dim strselectunion as c 'replaces ___selectunion___
            dim strsql as c 'sql defnitions for report
            dim strFilenameuser as c
            strFilenameuser = "to_be_determined.xls"
            dim strReportname as c
            strReportname = "to_be_determined"
            dim filter as c
            filter = ""
            dim order as c
            Order = ""
            dim sqlFilter as c = default ""
            dim options as p
            options.filter = sqlFilter
            options.order = ""
            dim printOptions as p
            printoptions.concatenate = .f.
            PrintOptions.HasWatermark = .f.
            PrintOptions.MultilingualSupport= .t.
            PrintOptions.LinearizeForWeb = .t.
            PrintOptions.Colors2GrayScale = .f.
            PrintOptions.ConvertHyperlinks = .f.
            PrintOptions.WatermarkType = "PDF"
            PrintOptions.WatermarkText = "D R A F T"
            PrintOptions.WatermarkFontName = "Times New Roman"
            PrintOptions.WatermarkFontSize = 172
            PrintOptions.WatermarkRotation = 450
            PrintOptions.WatermarkColorHex = upper("e8fed2")
            PrintOptions.WatermarkHorizPos = 120
            PrintOptions.WatermarkVertPos = 120
            PrintOptions.WatermarkOnTop = .F.
            PrintOptions.WatermarkPDF = ""
            PrintOptions.Encrypt = .F.
            PrintOptions.OwnerPassword = ""
            PrintOptions.UserPassword = ""
            PrintOptions.CanPrint = .T.
            PrintOptions.CanModifyDocument = .T.
            PrintOptions.CanCopy = .T.
            PrintOptions.CanAddNotes = .T.
            PrintOptions.Use128BitKey = .T.
            PrintOptions.EmbedFonts = .T.
            PrintOptions.JpegQuality = "Low"


            strFilenameuser = "Ruimten_leeg_"+e.datasubmitted.veld_peildatum+".pdf"
            strReportname = "ruimten_leeg"

            if e.datasubmitted.veldcentra_kode > "" then
            sqlfilter = " ruimten.centra_kode = :whatcentra_kode "
            end if

            options.filter = sqlFilter

            dim strFilename as c = Request.GetRequestTempFileName("pdf")

            a5w_report_saveAs(strReportname+"@[PathAlias.ADB_Path]\CptPortal.alb","pdf",filter,order,strfilename,global_variables(),printOptions,args,options)

            if file.exists(strfilename)
            Session.SaveDataAsFile(strFilenameuser,file.to_blob(strfilename))
            jscmd = "window.open('"+Session.FormatFileDataURL(strFilenameuser)+"');"
            end if
            'jscmd = jscmd+"alert('<a5:r>Gereed</a5:r>.');"
            Create_xls= jscmd
            exit function

            Comment


            • #7
              Re: Save Report

              Hi All

              Just an update on this.

              I eventually got back to working on this and the code seemed fine.

              How I got this to work was to change the join type to inner on the SQL genie builder and now the reports are building fine.

              Thanks to everyone for their input.

              Comment

              Working...
              X