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

multi-field sort, export records

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

    multi-field sort, export records

    Having now shared our WAS Tracking System with a few customers they have some requests. I think I have the general direction, but wanted to check out my solutions.

    1) Sort on multiple grid fields. Soln: add dialog with a few dropdown fields showing all possible sort fields. Add a Ascending/Decending field next to each. Use the info in the dialog with a xbasic sort and repaint function.

    2) Export to Excel. Soln: add AdvancedButton launching a function, set the current filter (set by a session variable) and exports those records to the local C drive using file.create().
    Steve Wood
    See my profile on IADN


    #2
    RE: multi-field sort, export records

    For #2, using file.create to save to the C drive will save a copy of your export on the server's C drive, probably not of much use to the web user. Take a look at the Web_Applications_Demo app where it explains a technique for generating PDF reports in the web browser - you should use the same method to save your export and serve it to the user. It is about 4 lines of Xbaisc that you'll need.

    -Lenny

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

    Comment


      #3
      RE: multi-field sort, export records

      Back to the web export. I see how I can create a Report and use report.saveas() to present it to the web user; but I don't see how I can create an export (which is an Operation) and do the same. I don't see a procedure to deliver or present the results of an Operation to the web user. Report.saveas() cannot call up an export.

      I tried Export.run_silent()and it will not run in a web environment - it hangs both the browser and Alpha and eventually I have to use task manager to close both.
      Steve Wood
      See my profile on IADN

      Comment


        #4
        RE: multi-field sort, export records

        export.run_silent() currently is not 'thread safe' which means that it cannot be run in a background thread. so this is why it hangs the web server. (since the web server runs each request as a separate thread).

        however, you should still be able to do an export.
        instead of doing export.run_silent(), just run the xbasic for the export directly.

        if you right click on the export operation in the control panel, and select 'show xbasic', you can easily see the appropriate xbasic.

        Comment


          #5
          WAS exporting records

          Selwyn;

          Thanks, I was able to properly export the file (named export.csv) to the session.folder.

          1) However, when I use response.direct to open the file, it opens as plain text (rather than in Excel). Its not the fault of the browser since I can take that same export.csv, move it to my corporate host, and it opens in Excel peoperly.

          2) I also tried to use [http_download_bg(filename,"c:\tracking.csv")] to transfer that file from the server to the client. Unless I did it wrong, this function does not seem to copy the file anywhere (server or client).

          Here's the AfterValidate code:

          dim filename as c
          dim exportfile as c
          select
          case DropDownBox1 = "Export Tracking"
          exportfile = "tempexport.csv"
          filename = session.session_folder + exportfile
          dim a_tbl as p
          a_tbl = table.open(""ADB_Path"\tracking")
          query.order = "Job_No"
          query.filter = "Customer=\"Secure\""
          query.options = "I"
          a_tbl.query_create()
          export.type = 0
          export.names = .T.
          export.file = filename
          export.options = ""
          export.field_sep = ","
          export.record_sep = ""CR""LF""
          export.fields = 4
          export.field1 = "job_no"
          export.field2 = "lastname"
          export.field3 = "client"
          export.field4 = "spouse"
          a_tbl.export()
          ' more case statements...
          end select

          if file.exists(filename)
          http_download_bg(filename,"c:\tracking.csv")
          response.redirect(session.session_url + exportfile)
          end if
          Steve Wood
          See my profile on IADN

          Comment


            #6
            RE: WAS exporting records

            1) Your browser uses the MIME type reported by the server in order to determine in what application to open the file being transferred. There is no official MIME type for CSV files so the Web Application Server returns the default text/plain and your browser displays it.

            As of the next patch, the Web Application Server will return the MIME type "application/vnd.ms-excel" for CSV files. This still may not workin all browsers since it is not a standard. If it does nt, your users will need to configure their browser to handle CSV files properly. You can refer to http://www.lbl.gov/ITSD/CIS/faqs/SOFTWARE_Desktop_Applications/10.html for basic instructions on how to do this.

            2) http_download_bg() would run on a client and download a file from a specific URL, not a filename. Your use of it is incorrect here. An example would be something like
                

            Lenny Forziati
            Vice President, Internet Products and Technical Services
            Alpha Software Corporation

            Comment


              #7
              RE: WAS exporting records

              Thanks - then currently there is no way for me to produce an export and then download it to a web-only client?
              Steve Wood
              See my profile on IADN

              Comment


                #8
                RE: WAS exporting records

                If you cannot wait for the next patch, you can configure your browser by following the instructions at the URL I included above.

                -Lenny

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment


                  #9
                  RE: WAS exporting records

                  Sorry, your url did not lead to any solution. My browser/file types already properly handle csv files (open in Excel). The url provides info on Netscape only, I'm on IE.
                  Steve Wood
                  See my profile on IADN

                  Comment


                    #10
                    RE: WAS exporting records

                    Attached is a file, csv.a5w, that will let you override the MIME type. To use this, change your response.redirect in your event handler to go to this page and pass the file to serve as csv_file, for example

                    response.redirect("/csv.a5w?csv_file=c:\a5webroot\session_folders\1234567890\export.csv")

                    -Lenny

                    Lenny Forziati
                    Vice President, Internet Products and Technical Services
                    Alpha Software Corporation

                    Comment


                      #11
                      RE: WAS exporting records

                      Lenny, not quite; and my results might be useful for your next patch...

                      The file opened in the browser as a result of this fix (csv.a5w) does not produce a file that *properly* opens in excel. It opens the files as one single chunk, all in cell A1. This same file, where it sits in session.folder, does open properly if dbl-clicked. So, neither file or browser are at fault.

                      You can try yourself at my site. Go to http://support.attorneystrust.com and use alpha/alpha to log in. Change the page from index.a5w to index_test.a5w and click the submit button. The results go into cell A1.

                      ----

                      My AfterValidate code is: response.redirect("/csv.a5w?csv_file=" + session.session_folder + exportfile ) yielding the following on the browser address line:

                      http://atdsserver/csv.a5w?csv_file=E:\A5Webroot\session_folders\cc6dc981bc4c412e91154dafdfa4dc97\tempexport.csv
                      Steve Wood
                      See my profile on IADN

                      Comment


                        #12
                        RE: WAS exporting records

                        Steve, it looks like you created your A5W page in the HTML Editor. The result is that your A5W page is a complete and valid HTML page. Typically this is correct, but it is not what you want in this case. This causes the resulting CSV file sent to the browser to contain HTML tags that you do not need. Use the A5W page exactly as I uploaded it and you should be fine.

                        -Lenny

                        Lenny Forziati
                        Vice President, Internet Products and Technical Services
                        Alpha Software Corporation

                        Comment


                          #13
                          RE: WAS exporting records

                          Thank you, that worked. (How do you put up with us?).

                          I had not noticed before that in the WAS control panel I can right-click on a file and select open-with. I had to first create csv.a5w in the HTML Editor, then open-with notepad and strip out html code automatically placed there by the editor. (I can't 'download' your example from the forum, it opens in my browser when I click on it.)

                          I like the total solution, I can use this same method to select any report/operation via my dropdownbox and the select case statement in the AfterValidate section.

                          Steve
                          Steve Wood
                          See my profile on IADN

                          Comment

                          Working...
                          X