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

Working with Dates

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

    Working with Dates

    I am having trouble getting the right output when I try to get the number of years calculated in a report. Rather than try to explain too much I have attached a small test database to ilustrate the problem. I have two questions (at the moment!)--
    1. How can I get "Member Years" to remain blank when there the "Member Date" field in a particular record is blank. It is currently giving me "2005" as a result of the formula "age(Mbr_Date)" I tried some "if..." calculations but no success yet.

    2. How can I get the Birthday to display only the month/day without the year, and to pick it up from the Birthdate field IF the Birthdate field is not blank, BUT also to allow me to enter it manually if the Birthdate field is blank. Reasopn: sometimes I have a birthday, but not the birthdate, and I would like to be able to record it.

    #2
    RE: Working with Dates

    Your attachment didn't make it, but in general

    1. if you want to avoid a calculation when one of the two fields is empty

    if(isblank("fieldname"),this,that)

    where "this" and/or "that" can be values or expressions that return values of the same type

    like

    if(isblank("member date"),0,calculation for member years)

    2. There is no format that displays part of a date, so you have to parse the character representation of the date.

    ? date()
    = {01/24/2005}

    ? dtoc(date())
    = "01/24/2005"

    ? left(dtoc(date()),5)
    = "01/24"
    There can be only one.

    Comment


      #3
      RE: Working with Dates

      ?date1
      = {01/24/2005}

      ?date_format(date1,"M:dd")
      = "1:24"

      ?date_format(date1,"MM/dd")
      = "01/24"

      ?date_format(date1,"MMdd")
      = "0124"

      Comment


        #4
        RE: Working with Dates

        Hi Wes

        To set a blank valued for a date field you need to use {} in your expression.

        Robert

        Comment


          #5
          RE: Working with Dates

          Thanks STeve. I was thinking of the options in the object properties format selection box, and even then you can select month and year.

          I think we still missed the problem of wanting to store a "partial" date such as "12/21" meaning Dec 21st, year unknown. I believe Wes will have to have another field for storing this partial date as text, as even with the available formatting options, there must be a year involved in a date field.

          I suppose one could default all unknown years to something like 9999 in order to filter them out when necessary, but a second field seems to be the better idea. One could then have a calculated field

          if(isblank("datefield"),character field,dtoc(datefield))
          There can be only one.

          Comment


            #6
            RE: Working with Dates

            Stan,

            You are corrent regarding your comments on parts of a date. Quite often I want to display a date in a format other than what Alpha offers 'out of the box'. There are functions that will grab parts of a date in numeric or chartacter format and allow you to display it however you want. You can pull the name of the month (either full name or partial by use of the left function) and the number of the date. Include or exclude the year as you wish. Also, you can use the following in your autoexec script and then have the date components available anywhere you want.
            Code:
            DIM GLOBAL vMon AS C
            vMon = cmonth(date())
            DIM GLOBAL vDay AS N
            vDay = day(date())
            DIM GLOBAL vDayname AS C
            vDayname = cdow(date())
            DIM GLOBAL vYr AS C
            vYr = cyear(date())
            DIM GLOBAL vtoday AS C
            vtoday = Var->vDayname+" "cmonth(date())+" "+day(date())+", +cyear(date())  - NOTE: vtoday should be all on one line
            You could also use the following as a calculated field whereever you want it.
            Today = "Today is "+ltrim(cdow(System->Date))+" "+ltrim(cmonth(System->Date))+" "+day(System->Date)+", "+cyear(System->Date)
            This yields something like 'Today is Monday January 24, 2005'

            You cal play with these to get and format the date components however you want.
            Dave
            Dave Jampole
            www.customalpha.com

            Women and cats will do whatever they want. The sooner men and dogs realize that, the happier they will be.

            Comment


              #7
              RE: Working with Dates

              THank you all for your ideas. I'll try some ot them and see how it goes as ASAP. Sorry about the attachment problem -- don't know hwy that happened. But you got the point anyway.

              Comment


                #8
                RE: Working with Dates

                Thanks for your input. Still having a problem --
                Here's the calculation setup I tried but it is an invalid expression: if(isblank(Birthdate),0,age(Mbr_Date)

                I am not sure why except that TYPES are not the same. Maybe that's the reason. If so, how do I get around that. I tried the following but it didn't help:
                if(isblank(Birthdate),0,dtoc(age(Mbr_Date))

                ALOS, I have tired to attach the database again. Hope it goes this time.

                Thanks for the help from you and all the others.

                Comment


                  #9
                  RE: Working with Dates

                  if(isblank("fieldname"),this,that)

                  the quotes around fieldname are not to show that you substitute your fieldname, they are required by the isblank() function.

                  if(isblank("Birthdate"),0,age(Mbr_Date)

                  if birthdate is your fieldname
                  There can be only one.

                  Comment


                    #10
                    RE: Working with Dates

                    Thanks again! Got it this time. Details, details, details!!
                    Now I'll work on the other issue -- question 2.

                    Comment


                      #11
                      RE: Working with Dates

                      You suggested --
                      ? left(dtoc(date()),5)

                      That works great -- got date to show 5 digits in a calculated field using
                      left(dtoc(Birthdate),5)

                      Question -- Why, in your example, did you add the ? in front of each line?

                      Regading keeping a birthday without having a year -- I think I'll just do as you suggested and justuse an additonal field to keep things simpler -- but this raises another question:

                      -- Can you record dates without adding the zeros in front of single digit dates and still get a correct sort? That is, to get 12/5 to come out before 12/20. If I am going to manualy enter dates (just m/d -- no year) I would like to just enter them without using zeros and still get an correct order when sorting. Is that possible?

                      Comment


                        #12
                        RE: Working with Dates

                        The question mark is used when you are in an "interactive" window

                        no, it won't sort correctly if you have single digit days


                        .
                        Cole Custom Programming - Terrell, Texas
                        972 524 8714
                        [email protected]

                        ____________________
                        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                        Comment

                        Working...
                        X