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

Help with automating saved queries...

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

  • Help with automating saved queries...

    Greetings,

    Been a while since I have been here, and a while since I have been coding which is my current issue I am sure.

    I have a bunch of saved queries for a database that I need to run every month. I have been doing them manually as I have been developing them as each one requires a bit of tweaking before it is complete. But they are stable and there are about 45 of them to run each month so I started the task of automating the process. Starting with Action Scripting I found the QUERY.RUN() function and a5_get_operations("query","database_name") function and that got me started and quickly into trouble.

    I have been unable to determine how to grab the resulting browse from the QUERY.RUN() to total up an amount field which would be written into a table rather than retyping the info for each query. Can someone point in the direction for how to capture the browse result so I can compute the items returned. There are times that "no records" are returned and the max is around 12 to 15 items, with the normal being between one and 5 or 6 items as a rule.

    Regards,
    Keith
    Keith Weatherhead
    Discus Data, Ltd
    kweatherhead@gmail.com

  • #2
    Re: Help with automating saved queries...

    Would need more details, and a sample to work with, in order to provide specific help.

    In meantime, have you considered using the tablesum() function to compute the total of the amount field in each table. This function will accommodate a filter, so the sum is computed over the desired range of records. If your browses are based on single tables this might permit you to write an action script to automate the sequence without using saved queries.

    Comment


    • #3
      Re: Help with automating saved queries...

      Tom,

      The table is a Customer A/R Table but unfortunately the Customer File does not have any kind of Parent/Child or Related Entity fields and these Saved Queries are just that. In a simple case think (WalMart/Sam's Club) and in a more complex situations think (Us Army or Air Force Installations) or (General Electric entities that may include things like Turbines, Appliances, Medical, Financial, etc). There is no way without developing a huge application to manage these to avoid Saved Querries.

      Manually running them produces the browses to be totaled for the entities exposure to the company. I do not care about the browses per se, just need to total up the items returned from the query. Tablesum() does not provide enough functionality to do this.

      Keith
      Keith Weatherhead
      Discus Data, Ltd
      kweatherhead@gmail.com

      Comment


      • #4
        Re: Help with automating saved queries...

        Keith,

        Have you considered using a tablesum() calc with a mapped table?

        Comment


        • #5
          Re: Help with automating saved queries...

          Tom,

          No, what do you mean by a "mapped" table?

          Is there no way to take a Saved Query (operation) and process its result?

          Keith
          Keith Weatherhead
          Discus Data, Ltd
          kweatherhead@gmail.com

          Comment


          • #6
            Re: Help with automating saved queries...

            Have you looked at a summary operation?

            Or looked at what it would take to have a relationship table?

            With what you've presented, it's difficult to understand the full scope of what you need to do.
            Al Buchholz
            Bookwood Systems, LTD
            Weekly QReportBuilder Webinars Thursday 1 pm CST

            Occam's Razor - KISS
            Normalize till it hurts - De-normalize till it works.
            Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
            When we triage a problem it is much easier to read sample systems than to read a mind.
            "Make it as simple as possible, but not simpler."
            Albert Einstein

            Comment


            • #7
              Re: Help with automating saved queries...

              Hi Al,

              I have a 3 million record table with a company month-end A/R summary.
              I have a series of Saved Query Operations, for specific company groups, query all of the related entities for that customer group.
              The query produces a browse with the matching records, which I want to total some data and write that to another table.
              Many of the saved queries have 3 or 4 panels of criteria (includes & excludes) in order to get the subset I want.
              I want to be able to sum up the open balance of the returned records and then go to the next query (about 45 in total for this master table)
              I ran these by hand for a few months to be sure that they capture all that I desire without any out-liers and am now comfortable with the results.

              I used Action Scripting to put the first Saved Operation Query into operation, QUERY.RUN(), then used: a5_get_operations("query", "summ_by_customer") to get a
              list of all the queries. In this case all of these special queries start with a "z", so I only run those queries. Each one produces a Browse Result that I am trying to
              figure out how to manipulate programmatically. Tablesum() (or something similar) would be great to process those browse results if I could figure out how to
              address them.... ???? Make anymore sense now ?

              Keith

              Originally posted by Al Buchholz View Post
              Have you looked at a summary operation?

              Or looked at what it would take to have a relationship table?

              With what you've presented, it's difficult to understand the full scope of what you need to do.
              Keith Weatherhead
              Discus Data, Ltd
              kweatherhead@gmail.com

              Comment


              • #8
                Re: Help with automating saved queries...

                Some additional sense.

                Still sounds like summary operation(s) is/are needed.

                You may want to contact IADN to get some detailed individual help.
                Al Buchholz
                Bookwood Systems, LTD
                Weekly QReportBuilder Webinars Thursday 1 pm CST

                Occam's Razor - KISS
                Normalize till it hurts - De-normalize till it works.
                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                When we triage a problem it is much easier to read sample systems than to read a mind.
                "Make it as simple as possible, but not simpler."
                Albert Einstein

                Comment


                • #9
                  Re: Help with automating saved queries...

                  Tablesum() (or something similar) would be great to process those browse results if I could figure out how to
                  address them.... ????
                  Tablesum() with the filter expression the same as used in your saved queries would yield sums on the same set of records displayed in the browse after such queries are run.
                  There can be only one.

                  Comment


                  • #10
                    Re: Help with automating saved queries...

                    Originally posted by Stan Mathews View Post
                    Tablesum() with the filter expression the same as used in your saved queries would yield sums on the same set of records displayed in the browse after such queries are run.
                    Stan, how do you specify the name of the Saved Operation Query in the TABLESUM() command ?

                    Keith
                    Keith Weatherhead
                    Discus Data, Ltd
                    kweatherhead@gmail.com

                    Comment


                    • #11
                      Re: Help with automating saved queries...

                      Didn't say you could. Right click on saved query name in control panel. View xbasic. Copy the filter. Use that in a tablesum().
                      There can be only one.

                      Comment


                      • #12
                        Re: Help with automating saved queries...

                        Originally posted by Stan Mathews View Post
                        Didn't say you could. Right click on saved query name in control panel. View xbasic. Copy the filter. Use that in a tablesum().
                        OK, one of my hopes was it would be self-maintenancing by simply adding new Saved Operations (Queries) going forward, oh well !!!
                        With all the functionality of A5, just cannot believe you cannot capture the Browse Result and process it.....

                        Thanx,
                        Keith
                        Keith Weatherhead
                        Discus Data, Ltd
                        kweatherhead@gmail.com

                        Comment


                        • #13
                          Re: Help with automating saved queries...

                          In Alpha, dbf functionality, browses and forms are not results to be captured. They are simply means to view records.
                          There can be only one.

                          Comment


                          • #14
                            Re: Help with automating saved queries...

                            Stan,

                            Do you know if you can programmatically get the code for the filter from a Saved Operation?
                            Could I dynamically generate the filters at run time, in other words?
                            I need to maintain the manual method of getting the results, too...

                            Keith
                            Keith Weatherhead
                            Discus Data, Ltd
                            kweatherhead@gmail.com

                            Comment


                            • #15
                              Re: Help with automating saved queries...

                              Never tried that and don't have Alpha available at the moment to check.
                              There can be only one.

                              Comment

                              Working...
                              X