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

Query.run() never returns accessible query

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

    Query.run() never returns accessible query

    When you run a

    Query.run(queryname)

    the action is to return a query in the default browse for the table or set associated with the saved query queryname. If you use the silent version

    Query.run_silent(queryname)

    the query is still run as part of the default browse, but the default browse never appears. In either case, the query result is not available to another browse or form of the same table or set associated with the query.

    Is there any way to force a saved query to run with the current form or browse without having to use the built in menu or toolbar operation?

    The only solution I can determine is to run the saved query, take the filter and order expressions, and rerun it on the desired form. But that means running the query twice, something I'm not willing to do.

    Anybody have any other suggestions?

    Regards,

    Ira J. Perlow
    Computer Systems Design & Associates
    [email protected]
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



    #2
    RE: Query.run() never returns accessible query

    One other item to mention.

    When you run a saved query with the built-in toolbar or menu options (which does functionally work), in maximized or windowed modes of the form, the Control panel displays even if it is currently hidden. This happens even in the runtime version. Placing a Controlpanel hide in the form's activation event removes the control panel, but it's an annoying flash.

    Hence, the search for an alternative method.

    Regards,

    Ira J. Perlow
    Computer Systems Design & Associates
    [email protected]
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture


    Comment


      #3
      RE: Query.run() never returns accessible query

      Assuming the current form or browse are based on the same table as the saved query, why wouldn't tbl.query_primary_put() do the trick?

      --tom

      Comment


        #4
        RE: Query.run() never returns accessible query

        Tom,

        Thanks for the idea. I had assumed this instruction only set the query, not actually running it, so I neglected to read the details of it that says it actually runs the query, however.....

        Unfortunately, when you run the query that way, it takes (Are you ready for this?) the filter expression and runs it as the order expression of the query (you can see this by doing a ctrl-I on the form and looking at the expressions for each).

        Any other ideas?

        Regards,

        Ira J. Perlow
        Computer Systems Design & Associates
        [email protected]
        Regards,

        Ira J. Perlow
        Computer Systems Design


        CSDA A5 Products
        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
        CSDA Barcode Functions

        CSDA Code Utility
        CSDA Screen Capture


        Comment


          #5
          RE: Query.run() never returns accessible query

          Ira,

          Perhaps an over simplified suggestion and not what you are looking for.

          I run lots of scripted queries from a drop down custom menu. I am sure that the same process runs a saved query.

          Michael

          Comment


            #6
            RE: Query.run() never returns accessible query

            Michael,

            As I stated earlier, I used the Toolbar and Menu choices (on customized versions) to do this but the Control Panel pops up. Hiding the Control Panel again on the activate event of the form makes it look better, but still has an annoying flash of the control panel.

            Regards,

            Ira J. Perlow
            Computer Systems Design & Associates
            [email protected]
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


              #7
              RE: Query.run() never returns accessible query

              Hi Ira

              I am not sure if your problem is the same as mine was.

              I wanted my QUERY attached to a specified form so I could see only the records queried when viewing the form and to retrieve the search count.

              This is the script fragment I finally came up with after a lot of help from Mr. Rabins and others. It might point you in the direction you want.
              ---------
              Q_filter = query_filter_get("S_Sele_perform_period")
              Q_order = query_order_get("S_Sele_perform_period")

              :B_sch_results:tables:teletrac.filter_expression = var->q_filter
              :B_Sch_Results:Tables:Teletrac.order_expression = var->Q_order
              :B_Sch_Results:Tables:Teletrac.Query()

              ------

              Good luck
              Robert

              Comment


                #8
                RE: Query.run() never returns accessible query

                Robert,

                As I said earlier;

                The only solution I can determine is to run the saved query, take the filter and order expressions, and rerun it on the desired form. But that means running the query twice, something I'm not willing to do.

                The code you present gets the filter and order expressions, then runs them on the current form. But this would be convoluted for the purposes of my application, and would actually require that it be run twice (which is what I wanted to avoid), but thanks for your input.

                Regards,

                Ira J. Perlow
                Computer Systems Design & Associates
                [email protected]
                Regards,

                Ira J. Perlow
                Computer Systems Design


                CSDA A5 Products
                New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                CSDA Barcode Functions

                CSDA Code Utility
                CSDA Screen Capture


                Comment


                  #9
                  RE: Query.run() never returns accessible query

                  Ira,

                  Check me on this. If the saved query exists, and has been run in the past, and is therefore by now probably stale, who says it must be run again. In other words, can't it just exist to hold filter and order expressions ready to be retrieved by using the code Robert supplied.

                  Thus, you would not have to run the query twice.

                  Notwithstanding the above, the procedure is--as you say--still rather involuted.

                  Bill
                  Bill Hanigsberg

                  Comment


                    #10
                    RE: Query.run() never returns accessible query

                    Bill,

                    The problem is that in order to not run the query twice, they must follow the following procedure;

                    1. Do a query by form (for this case anyway) on another form other than the desired final one for display
                    2. Save the query
                    3. Cancel the current query
                    4. Run a saved query on the display form via a run dialog I provide

                    I don't want to have 2 and 3 both there. The exit from a query by form has no event that can be captured (at least not in this particular application - There is a really complex way to do it with other apps) to run code to do other stuff that needs doing (like go to the display form).

                    Anyway, the code is real sloppy that I've tried so far. I'm still slugging at it, but it's fighting me every step of the way.

                    Regards,

                    Ira J. Perlow
                    Computer Systems Design & Associates
                    [email protected]
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                      #11
                      RE: Query.run() never returns accessible query

                      Hi Ira


                      This fragment runs in a script where the user is prompted for values and then the saved search is run only once using the outlined procedure above. The form "B_sch_results" is loaded but not activated. When the Query is finished running the form is activated with the records filtered based on the query.

                      It only runs once. As long as I don't run a new query for the form the old Query remains active.

                      You must be trying something different from what I think you are.

                      Good luck

                      Robert

                      Comment


                        #12
                        RE: Query.run() never returns accessible query

                        Bill,

                        Also, apparently (in A5V4 Build 230 anyway),

                        query_filter_get(queryname) returns the order expression
                        query_order_get(queryname) returns the filter expression

                        I wonder at which point the code reverses them?...Perhaps we're in a "singularity" where everything is backwards? :?)


                        Regards,

                        Ira J. Perlow
                        Computer Systems Design & Associates
                        [email protected]
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                          #13
                          RE: Query.run() never returns accessible query

                          Hi Ira

                          Here is a more complete example.

                          The following form is active->"main_contact_form"

                          The script is called with a button, you are prompted for several variables then the following occurs.

                          -------
                          Q_filter = query_filter_get("S_Sele_perform_period")
                          Q_order = query_order_get("S_Sele_perform_period")

                          :B_sch_results:tables:teletrac.filter_expression = var->q_filter
                          :B_Sch_Results:Tables:Teletrac.order_expression = var->Q_order
                          :B_Sch_Results:Tables:Teletrac.Query()

                          :B_sch_results.activate()

                          -------

                          Hope this is clearer

                          Robert
                          :main_contact_form.hide()

                          Comment


                            #14
                            RE: Query.run() never returns accessible query

                            Hi Ira

                            This is clearer???

                            Sorry I goofed when pasting the script fragment.

                            It should read

                            :B_sch_results.activate()

                            :main_contact_form.hide()

                            Robert

                            Comment


                              #15
                              RE: Query.run() never returns accessible query

                              To all,

                              I haven't had time to try this, but I wanted to add this to the thread in case someone else needed it. There is a new XBASIC method (documented in readme file) in version 4.01 and up that does what I needed (and hopefully works!) As it states in the readme;

                              formpointer.run_saved_query(C name)
                              The method runs the saved query in the current form and applies it to the current form.

                              Note that a saved query is an operation that can also be run using the query.run() method. The difference between using query.run() and formpointer.run_saved_query is that the former runs the query in a new session and does not apply the query to the current form window.


                              Regards,

                              Ira J. Perlow
                              Computer Systems Design & Associates
                              [email protected]
                              Regards,

                              Ira J. Perlow
                              Computer Systems Design


                              CSDA A5 Products
                              New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                              CSDA Barcode Functions

                              CSDA Code Utility
                              CSDA Screen Capture


                              Comment

                              Working...
                              X