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 by Name and Date

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

    Query by Name and Date

    I have a table that I need to query by name and date.
    I would like to ceate a button on my form so when I click it will ask for Date and Name.
    I have used the query genie but would like to only select Date and Name.
    Where do I need to start?

    I have read the Guaranteed 1-Hour Guide to Becoming a Query Filter Expert but I'm not quite at that level (?)
    David
    A5V12.3
    Win7, 64 bit
    Qbks 2018 Enterprise
    QODBC R/W

    #2
    RE: Query by Name and Date

    David,

    Whether you use Action Scripting or the Xbasic Script genie for the OnPush event, you can easily accomplish these prompts. First select "Dialog Boxes" as the category and "Display an Xdialog Box" as an action.

    You will be prompted for all needed info. This will allow for more than one variable of different types. Give this a try and let us know if you have any difficulty.

    Steve

    Comment


      #3
      RE: Query by Name and Date

      The easiest way to do what you are asking is to create a saved query operation via the operations genie. I suppose you are supposed to know that your can type in

      var-"askc_Name and var-"askd_Date

      in the expression builder, as they are not "chooseable".

      Here's the xbasic revealed behind a query operation I created to test for a solution to your request. (F01 and F39 are field names)

      filter = "F01=Var-"askc_Name.and.F39=var-"askd_Date"
      order = ""
      options = ""
      description = "Saved Query: test"
      show_all_flag = .f. 'user cannot turn off the query
      layout_type = "browse" 'to open a form, set this to "form"
      layout_name = "" 'This will open the default layout. You can also specify a named layout here
      a5_open_layout(layout_type,layout_name,"cost",filter,order,description,show_all_flag)
      There can be only one.

      Comment


        #4
        RE: Query by Name and Date

        And, oh yes, ...

        If cName is the name and dDate is the date, try a query order of:

        dtos(dDate)+alltrim(cName)

        Steve

        Comment


          #5
          RE: Query by Name and Date

          Steve, I tried what you said, I get a prompt for a Date but nothing happens.
          When I created the Dialog box, the script genie comes up and I created 2 new variables, Date as date type and Name as character. Could not find a place to put
          dtos(dDate)+alltrim(cName)

          I have the button on a form of 1 table and also an embedded browse. What I'm tring to do is display (in the browse) of records of a certain date and name. Then I have a calculated field showing the total for the day.

          Stan, I tried what you said and even pasted your example replacing with my field names and when I run the saved operation from my form It opens another browse but no query.

          When I use just the Query genie on my form, It works good.

          I've tried both ways a lot and I'm sure I'm missing some thing or things on both.

          I know some day the light will come on.
          I do appreciate
          your help.

          Thanks,
          David
          David
          A5V12.3
          Win7, 64 bit
          Qbks 2018 Enterprise
          QODBC R/W

          Comment


            #6
            RE: Query by Name and Date

            "It opens another browse but no query." - The browse it opens is the result of the query.

            "I have a table that I need to query by name and date.
            I would like to ceate a button on my form so when I click it will ask for Date and Name." - then what? Do you want the original form to be filtered on the results of the query?
            There can be only one.

            Comment


              #7
              RE: Query by Name and Date

              Yes, I want the filtered data on the form I have open.
              When I run the operation from my form, a dialog box opens asking for Name and Date. I enter the info and a new browse opens with no query applied. All of my records are there, not filtered.

              What I normally do is open my form with the embedded browse, I go to Menu bar and select Query, then Query Genie, then I select my Date field, then in the next column I select "is on the date(s)", then in the 3rd column I select the triangle in box and window opens for "Value", then I click that box and anther windows opens with all of the dates in my table, I select the Date, click OK, then if I just want the date only, i select the Run Query, then select close and there is just the filtered data for that date only.

              That's what I'm trying to automate.

              Thanks,
              David
              David
              A5V12.3
              Win7, 64 bit
              Qbks 2018 Enterprise
              QODBC R/W

              Comment


                #8
                RE: Query by Name and Date

                I got it work except I would like to have the query filter the form layout that I already have. Because I have calculated fields total data for the day.

                Here is the code in the saved operation.

                filter = "Date = var-"AskD_varaskc_Name_and_varaskd_Date"
                order = "recno()"
                options = ""
                description = "Saved Query: New Date"
                show_all_flag = .f. 'user cannot turn off the query
                layout_type = "browse" 'to open a form, set this to "form"
                layout_name = "" 'This will open the default layout. You can also specify a named layout here
                a5_open_layout(layout_type,layout_name,"tm sheet",filter,order,description,show_all_flag)

                Do I need to put a layout name in here? If so, where would I find the layout name?

                Thanks,
                David
                David
                A5V12.3
                Win7, 64 bit
                Qbks 2018 Enterprise
                QODBC R/W

                Comment


                  #9
                  RE: Query by Name and Date

                  To open a form instead of a browse....
                  filter = "Date = var->AskD_varaskc_Name_and_varaskd_Date"
                  order = "recno()"
                  options = ""
                  description = "Saved Query: New Date"
                  show_all_flag = .f. 'user cannot turn off the query
                  layout_type = "form" 'to open a browse, set this to "browse"
                  layout_name = "" 'This will open the default layout. You can also specify a named layout here
                  a5_open_layout(layout_type,layout_name,"tm sheet",filter,order,description,show_all_flag)

                  "Do I need to put a layout name in here?" - If you dont put the layout name in Alpha uses the default layout. "If so, where would I find the layout name? " - Layout name is the name you saved the form as.

                  You have substituted "tm sheet" in the code in the place where the table name is supposed to be. If this is a table name you would be advised to not use table names containing spaces. It is better to either close up the space, use an underscore, etc.
                  There can be only one.

                  Comment


                    #10
                    RE: Query by Name and Date

                    Hey thanks Steve and Stan.
                    It works great.
                    Thats just what I needed.

                    Thanks again,
                    David
                    David
                    A5V12.3
                    Win7, 64 bit
                    Qbks 2018 Enterprise
                    QODBC R/W

                    Comment

                    Working...
                    X