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 on date

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

    #16
    RE: Query on date

    Scott,

    Does this also mean that it fails when you format the date for your region?

    i.e.

    instead of: query.filter="rm_date={11/13/2003}"

    you use: query.filter="rm_date={13/11/2003}"

    -----------------------------------------------

    I've tried to replicate the error you're seeing using the AlphaSports sample.

    OPen AlphaSports.
    Close the opening menu form.
    Choose View, then Code Editor.

    If I enter this in the Interactive Editor, and press ENTER as each line is typed, the query filter works just fine.
    Code:
    tbl = table.open("Invoice_header")
    dim test_date as D
    test_date = {01/15/2002}
    query.filter = "Date = { " + dtoc(test_date) + " } "
    query.option = "M"
    query_order = ""
    idx = tbl.query_create()
    ?idx.records_get()
    = 2.000000
    idx.drop()
    tbl.close()
    In this case I knew in advance that 01/15/2002
    was a valid field value in two records in the
    header table.

    Since your script is indistinguishable I would guess
    the difficulties you're getting result from:

    a) differences in how the regional formatting of
    your date fields are being handled internally; or

    b) corruption in your form.

    -- tom

    Comment


      #17
      RE: Query on date

      in the button, change the code for the query to

      query.filter="rm_date=date()"

      and that should work.

      Comment


        #18
        RE: Query on date

        Well this gets more and more interesting.. the between dates option works when run once, but, a table re-index must be run in order for it to work twice.

        To clarify, if the delete is run using the between option, then records added to the table and the delete run again (all without exiting the Form) - the second delete does not delete any records.

        There is a stability issue of some sort here. I re-instated the 'invalid' field rule default of date(), and changed the query.filter back to 'rm_date=date()' and it is now working (and works when you run it twice). If I set ws_date=date() and in the filter use 'rm_date=ws_date' it does not work.. Was it a re-index that allowed it to work with rm_date=date()? I guess I will only know after further testing.

        On that, the Form also has a date range purge option which runs a delete operation for a date range as input by the user. Running this operation does not delete any records if it is run after the above single date delete routine is run - but - it runs OK if I exit the Form go back into the Form and run the operation. Again to clarify, if I use the single date delete routine it deletes records for 15/11/2003 - if I then run the date range delete (an operation) without exiting the form and run it for 13/11/2003-14/11/2003 no records are deleted - even though they exist and viewable in the browse.

        I suspect there is a bug here - maybe in the file system or to be more specific A5's management of the file system. I guess all I can do is bring this thread to the attention of Alpha Software and hope they will put some effort in to resolving it.

        Thanks to all for your input - it is interesting that people are formulating their date based queries quite differently - and for them it works - but on our date format and with the table involved they do not.

        Comment


          #19
          RE: Query on date

          Hi Pat

          I think I will get them to use right click / delete on the browse in order to delete a record. For some time I thought this option was broken, until I worked out that Change, along with Delete, must be enabled in the Browse Properties in order for delete to work (if you just enable Delete and not Change, you still get the Delete option when you right click but it does nothing).

          One would think that just Delete enabled would enable you to delete a browse row - but not so..

          Regards,
          Scott

          Comment


            #20
            RE: Query on date

            Scott,

            The sequences you describe remind me of times when I was surprised to learn that some previous process had filtered my table without me realizing it. When I ran a query (expecting it to run against all the records) it failed because the table had already been filtered in such a way that no qualifying records were 'in view' for the 'new' query to run against.

            I recommend you re-set the form's primary index when the form opens, and each time it is activated. Especially, after each operation, so that the next operation will begin with 'show All' in effect.

            -- tom

            Comment


              #21
              RE: Query on date

              Scott,

              If delete is not restricted, Ctrl-D will delete any row of an embedded browse.

              -- tom

              Comment


                #22
                RE: Query on date

                Scott,

                I discovered just now that if you remove the ordering expression you previously embedded in the properties of your form, your query filter works fine. When the form opens the ordering expression places the table in an inverted date sequence.

                I'm not sure how to fix this, but will look a bit further.

                First idea is that you'll want to specify the same display sequence in the query.order as your form is using. Your current code tries to change the sort sequence in the query. This may be conflicting with the sort sequence embedded in the form.

                --tom

                Comment


                  #23
                  RE: Query on date

                  Hi Tom

                  You may be on to something there. I will change the order sequence to match and test some more.

                  Regards,
                  Scott

                  Comment


                    #24
                    RE: Query on date

                    Hi Tom

                    Sorry - but how do I "re-set the form's primary index" - do something on init?

                    Regards,
                    Scott

                    Comment


                      #25
                      RE: Query on date

                      As it stands, using query.filter="rm+date=data()" is now working, but I have added the order command to match the form to see if that gives more stability. I did the same 'order' change to the Delete Operation (allows date range delete)which is also called from the form, however, the date range delete operation still does not work if I run the single data delete before running the date range delete operation - in such a case, an index rebuild is required before the delete operation will work.

                      Regards,
                      Scott

                      Comment


                        #26
                        RE: Query on date

                        grr - i just went back to double check the order expression added to the delete operation - viz: "invert(cdate(Rm_date))+rm_racecode" and have found that it did not and will not save the order expression. I then tried just rm_date but it would not save it either. Looks very much like a bug? Can you see if your copy of A5 will save an order expression on a delete operation.

                        Regards,
                        Scott

                        Comment


                          #27
                          RE: Query on date

                          some more testing - I just went through a period of time where the delete operation would not delete any records - even after re-indexing, exiting A5, re-indexing again etc still no joy.

                          I had to zap the table and import some new records before it would then work. Something is definitey screwed up here and it keeps leading me back to think that there is something going wrong in A5's handling of the file system..

                          Comment


                            #28
                            RE: Query on date

                            Scott,

                            I'm sorry to have sent you on a wild goose chase. The form's filter is irrelevant.

                            Unzip the attachment to an empty folder.

                            I changed the query filter to base it on the character equivalent of the current date. i.e. not asking the query filter itself to convert the date value to string.

                            I also made provision to run the query against an unfiltered table.

                            Seems to be working ok.

                            On your second problem I also made some progress. I changed the delete race script to position the record pointer at the race preceding the one being deleted. I think the script is straightforward, let me know if you have questions. The trick was remembering that the display sequence is not in record number order. so, my script collects the record number for the row to be deleted, then moves to the previous record and collects it's record number. After the deletion the script moves the record poiner to the previous row and refreshes the browse.

                            Hope this helps, even with all my typos.

                            --tom

                            Comment


                              #29
                              RE: Query on date

                              Hi Tom

                              Thanks for your efforts.

                              I have decided to stay with "rm_date=date()" in the query.filter - it seems to be behaving now - although I have no idea why it would not work previously. One thing I added was a topparent.commit() before running the Query and Delete (to make sure a record was not being edited that it subsequently needed to delete - but this was not the cause of earlier woes). I have also removed a couple of the indexes that were on the table.

                              It seems that rebuilds will sometimes fix the running of the Delete Operation but it is far from stable. I have taken that option out of the Form and placed it as a seperate menu option and run a rebuild on the table when it fires up - not really ideal when there is a volume of data in the table - but at least it works now most of the time.

                              On the record delete issue in the browse - after discovering that one must have Delete and Change enabled in the browse properties in order for a Right Click/Delete to work, I then modified the Delete Record button to do a Delete Record at the Browse level rather than the parent level and this seems to work well - the browse is refreshed without losing your current position.

                              I found that your solution to the browse position on Delete worked well until one clicks on another record in the browse (straight after a delete) - upon which the browse losses its position and displays from the top again - but I certainly appreciate your input and would have gone down this path if the Delete at browse level on a button did not fly.

                              I only wish I could nail what was causing the original query.filter issue - I hope the issue does not return with further testing!

                              Regards,
                              Scott

                              Comment


                                #30
                                RE: Query on date

                                i took a look at the sample files and was able to duplicate the problem.

                                the problem seems to be related to some kind of subtle corruption in the table.

                                i was able to correct the problem by

                                1. edit the structure of the r_races table.
                                2. add a new temp field called "date2" (type = date)
                                3. do a global Update operation on r_races table and set "date2" = "rm_date"
                                4. edit the structure of the r_races table.
                                5. rename "date2" to "rm_date"

                                then, from the interactive window:

                                t2=table.open("r_races")
                                query.filter = "rm_date = {11/14/2003}"
                                it = t2.query_create()
                                ?it.records_get()
                                = 169.000000

                                this show that it now works, where previously it returned 0 records.

                                how the table header got corrupted in the first place is a total mystery to me.

                                Comment

                                Working...
                                X