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

Combined Date & Time Filter

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

    Combined Date & Time Filter

    I need to select records based on 2 items.

    1. Date (Field in table)
    2. Time (Field in table)

    The problem I have is that for any 1 day (date) the time range is 09:00 to 02:00. So, if I enter the date (for report) of say 31/03/2001, I want it to include the records which satisfy the time criteria as well i.e 09:00 on 31/3/2001 to 02:00 on 01/04/2001.

    So far I have come up with the following which works for 1 day:

    (Call_date=DATE GIVEN .and. toseconds(right(alltrim(call_time),8))>= 32400).OR.
    (Call_date=DATE GIVEN+1 .and. toseconds(right(alltrim(call_time),8))
    If It Works First Time, There's Something Wrong!!!

    #2
    RE: Combined Date & Time Filter



    Chris:

    Maybe I'm just mis-reading this, but it seems like you already have most of the answer.
    I not sure I get the time part of the question. If a day is (always)
    between 9:00 AM and 2:00 PM, why even bother with the times, unless you are
    asking the user to enter a time, like 12:00 PM on 03/31/2001 -" 01:00 PM on
    04/02/2001?
    Anyhow, you need to aquire two dates from the user, or offer a dialog box
    that, on a button push, say "THIS MONTH" calculates the first day of
    the month (based on the system date) and the last day of the month, and sets
    those dates as variables. SEE BELOW FOR A SAMPLE DIALOG BOX POSTED IN THE
    CODE ARCHIVE!
    Below is a expression that will give you 24 hour blocks, although the 32400
    and 50400 needs to be changed to a variable if you want misc times for the
    reports. If not using misc. times, and using solid days, you can drop the
    time part of the expression.
    I included the RIGHT and ALLTRIM, although I'm not sure why they are
    there. It seems like the fields actual characters should be sized exactly
    to the time footprint you are using, but maybe your drawing off a time card run,
    or the like...

    ( (FIELD_CALL_DATE
    "= VAR_BEGIN_DATE) .and. (toseconds(right(alltrim(FIELD_CALL_TIME),8))"=
    32400) )
    .AND.
    ( (FIELD_CALL_DATE
    "= VAR_END_DATE) .and. (toseconds(right(alltrim(FIELD_CALL_TIME),8))"=
    50400) )
    If your using this in some operation outside the
    report, you must use global variables.
    Look in the code archive for a recent post that
    illustrates a dialog box that offers the user a button push selection of months,
    weeks, days, etc... if you want to, and change the formula above to evaluate the
    correct time parameters based on the system date. Most of the formula is
    already worked out for you in Terry's example. If other than a button push
    selection is desired, a begin date and an end date are still needed from the
    user.
    Hope this is what you were looking for... If not,
    I appologize. Sometimes I have trouble reading between the lines!!!
    Craig



    Comment


      #3
      RE: Combined Date & Time Filter

      Chris:

      The recent post in the archive is labeled "setting dates", and includes a downloadable sample.

      Craig

      Comment


        #4
        RE: Combined Date & Time Filter

        Thanks Craig, I'll try to use your suggestion. The point I was trying to make is that for this particular client the accounting day is split into 2 shifts; 09:00 to 18:00 and 18:00 to 02:00. The reporting needs the time as the for obvious reasons an accounting day can be 2 dates. For example, 31/03/2001 is, in fact 31/03/2001 at 09:00 to midnight, AND 01/04/2001 at midnight to 02:00.
        If It Works First Time, There's Something Wrong!!!

        Comment


          #5
          RE: Combined Date & Time Filter

          Chris,

          what's the format you are using for the time values?

          I'm thinking that if you were to use a twenty-four hour format (military time), your filter could include alternatives, depending on whether the time is greater than 1200 hours or not.

          i.e.

          if timevalue

          Comment


            #6
            RE: Combined Date & Time Filter

            Thanks Tom,

            I am already using the 24 hour format.

            Chris
            If It Works First Time, There's Something Wrong!!!

            Comment


              #7
              RE: Combined Date & Time Filter

              Chris, sorry about the previous post, I misunderstood your question.

              the between() function can be used in a filter expression to limit the output to a specified range of dates. check the examples in the xbasic ref. manual.

              Comment


                #8
                RE: Combined Date & Time Filter

                Tom

                How would I use BETWEEN in my scenario:

                e.g. I wish to find all the records that satisfy the date range 01/03/2001 to 31/03/2001. Bearing in mind that the times for these records will mean a further date of 1/4/2001.

                Each DAY is comprised of 17 hours from 09:00.

                So, if I use 31/3/2001, I will get those records that have a date of 31/03/2001 AND time>= 09:00 AND those records that have a date 01/04/2001 AND time
                If It Works First Time, There's Something Wrong!!!

                Comment


                  #9
                  RE: Combined Date & Time Filter

                  Chris,

                  There was a post not too long ago in reference to searching for time that continued form one day to the next. A solution was found but I don't recall what it was or the subject. Perhaps others might recall the subject of the post. I suspect your answer is there.

                  kenn
                  TYVM :) kenn

                  Knowing what you can achieve will not become reality until you imagine and explore.

                  Comment


                    #10
                    RE: Combined Date & Time Filter

                    Thanks Ken,

                    I think I found the posts you are referring to, but unfortunately they don't apply to my situation. I am really stuck on this problem, and I don't seem to be able to get around it. Any further suggestions would be most welcome in addition to those already here.

                    Chris
                    If It Works First Time, There's Something Wrong!!!

                    Comment


                      #11
                      RE: Combined Date & Time Filter

                      Add a field to your table - I call ours Query and in field rules define it as a calculated field. The calc definition is

                      CDATE(APPT_DATE)+PADL(LTRIM(TRIM(STR(TOSECONDS(APPT_TIME)))),6,"0")

                      this creates a character string that combines the date and the seconds.

                      To query for a range you need to convert your search string into a like format. So to search for records between January 1 and March 31 (assuming that the users don't need to think about the following day requirement) your code would take the second input date and add 1; so your code would search for dates between 01/01/2001 and greater than 9:00 am and 04/01/2001 and less than or equal to 2:00 am.

                      This would translate into a query filter of

                      Between(query,200101032400,20010401007200)

                      and, if the table is indexed on the "Query" field. will be instantaneous.

                      Finian
                      Finian

                      Comment


                        #12
                        RE: Combined Date & Time Filter

                        PS the Query field needs to be defined as C, 14 and in the example above the time field is called Appt_Time

                        Finian
                        Finian

                        Comment


                          #13
                          RE: Combined Date & Time Filter

                          Geez, I'll get this right sometime ...
                          a correct sample filter would be

                          Between(query,"200101032400","20010401007200")

                          F.
                          Finian

                          Comment


                            #14
                            RE: Combined Date & Time Filter

                            Finian

                            Thanks very much - It hit the nail on the head, such a beautiful way of doing it. I wonder how long it took you to think of this solution?

                            Chris
                            If It Works First Time, There's Something Wrong!!!

                            Comment


                              #15
                              RE: Combined Date & Time Filter

                              >

                              No time at all, since the calculated field was lifted directly from our appointment scheduler which is built on queries based on that expression. And while I'd like to credit inspiration or perspiration for the original idea/guideline, I can't since it was generously given to me by my friend and mentor Peter Wayne.

                              Finian
                              Finian

                              Comment

                              Working...
                              X