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

report(based on set) won't use xbasic query

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

    report(based on set) won't use xbasic query

    Hello All,

    Using xbasic, I have not been able to query a set, then run a report based on the set, and have the report use the query I created via xbasic without adding order and filter parameters to the :report.print() method. I'm assuming this is the way it is. We can do this with with a report based on a single table, but apparently not with a report based on a set. I know it's simple enough to just add the parameters to the report.print() method, but I hate to add to the overhead by running a query and then forcing the report to run the same query all over again (unless Alpha is smart enough to use the just created xbasic query).

    t = table.open("mySet.set")
    query.filter = "state = 'IA'"
    t.query_create()
    :report.print("myReport")

    Any thoughts on this?

    Thanks,
    Jim

    #2
    RE: report(based on set) won't use xbasic query

    Jim,

    This should be working for you.

    Check the properties of the details region of your report layout. Leave the order and filter expression boxes empty, and be sure to set the report to:

    Base Report On Current Selection of Records

    If this has already been selected, I suspect something in the way in which you are calling the report is releasing the query, perhaps by selecting another index or something, just as the report layout is loading...

    To confirm that this works, try this.
    Using the Invoice app that ships as a sample with Alpha Five, there's an Invoice report, based on the Invoice Set.

    If you do a QBF using the default form for the SET, and select a single customer_id, then close the default form, and immediately run the Invoice report you will see that it's scope is automatically limited to the selected customer_id.

    -- tom

    Comment


      #3
      RE: report(based on set) won't use xbasic query

      Jim,

      I have sometimes found it easier to filter just on the parent of the set using

      t=table.current(1)

      from a form based on the set

      Perhaps this will help.

      Jay Talbott
      Jay Talbott
      Lexington, KY

      Comment


        #4
        RE: report(based on set) won't use xbasic query

        Thanks for your replies Tom and James,

        I'm doing this all from within xbasic. I'm not at a form that has anything to do with this. Try this with the sample invoice database that comes with A5. Create this script and you'll see what I'm getting at. The report shows all the records, but the query only has two. This report's query is defined to 'Base report on current selection of records'. Again, this is doable with a report based on a single table, but I've not be able to make it work with a report based on a set.


        ''XBasic
        t = table.open("invoice.set")
        query.filter = "sales_rep ='JSM'"
        ndx = t.query_create()

        :report.preview("invoice")

        vnum = ndx.records_get()
        ui_msg_box("Records in the query", str(vnum))

        ndx.drop()
        t.close()


        Thanks for you help,
        Jim

        Comment


          #5
          RE: report(based on set) won't use xbasic query

          Jim, I know it's not a complete answer, but ...

          Try this:

          'XBasic
          t = table.open("invoice.set")

          :report.preview("invoice","invoice_header->sales_rep = 'JSM'")

          t.close()


          -- tom

          Comment


            #6
            RE: report(based on set) won't use xbasic query

            Hi Tom,

            This will work, but what I'm thinking is that it causes the report to do another query when I've already just done one via xbasic. I don't know if Alpha is smart enough to reuse the just created query or not. Also, it brings up the issue of concurrency. I want to be sure that the report and my query are one and the same.

            Thanks,
            Jim

            Comment


              #7
              RE: report(based on set) won't use xbasic query

              You're correct, but in many contexts there's no need to run the antecedent query. Just supply the filter expression directly to the preview method.

              As for why this is happening, I suspect it's because your xbasic script does not result in an MPX being saved to disk, as would a classic QBF. The recordset exists in memory, but is not on disk. I'm guessing the report can't see the query because it's neither a saved query operation, nor an MPX... Wonder if there's some way you can force the MPX to be created?

              -- tom

              Comment


                #8
                RE: report(based on set) won't use xbasic query

                Hi Tom,

                >>but in many contexts there's no need to run the antecedent query>I suspect it's because your xbasic script does not result in an MPX being saved to disk, as would a classic QBF. The recordset exists in memory

                Comment


                  #9
                  RE: report(based on set) won't use xbasic query

                  Jim, have you tried opening a form based on the same set, running your code to query the set upon which the form is based (taking care to change absolute references, to relative references... i.e. tbl.current() instead of tbl.open()), and then calling your report while the form is open? It seems to me that this could be done while the form is hidden, so the user need not be aware of it...

                  -- tom

                  Comment


                    #10
                    RE: report(based on set) won't use xbasic query

                    Good idea Tom, I'll try this. I'm not in love with the overhead of opening a form needlessly, but I'll give it a try.

                    Thanks,
                    Jim

                    Comment


                      #11
                      RE: report(based on set) won't use xbasic query

                      Jim, the overhead need not be significantly different than what you're doing with table.open(). Don't put any fields on the form. Just use it as a device to open your set.

                      -- tom

                      Comment


                        #12
                        RE: report(based on set) won't use xbasic query

                        Tom:

                        Just to confirm Jim's experience which I have been dealing with recently and no, having the xbasic query run on a form based on the set doesn't work either.

                        I think that you always have to do both (run the query first and then print/preview the report) since the return, if there are no records to print, is ugly. Either nothing happens if the report is sent directly to the printer or you must preview and the user has to wait and then click out of an empty preview.

                        Finian
                        Finian

                        Comment

                        Working...
                        X