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

Calculate age as at January 1st !!!

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

    #16
    Re: Calculate age as at January 1st !!!

    Yip, I do have a DOB field which is a datetime field as required by the sql formula

    Comment


      #17
      Re: Calculate age as at January 1st !!!

      Yip, I do have a DOB field which is a datetime field as required by the sql formula
      what formula?
      date of birth can be defined as date in your sql table definition not necessary to have datetime.
      or get the date from the datetime, then just eliminate the code you have for AgeN and insert my code and see what happens.
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


        #18
        Re: Calculate age as at January 1st !!!

        Originally posted by GGandhi View Post
        what formula?
        date of birth can be defined as date in your sql table definition not necessary to have datetime.
        or get the date from the datetime, then just eliminate the code you have for AgeN and insert my code and see what happens.
        Hanghi,

        The window just carry on "loading" No reaction.

        I removed my var agen code as you said.

        Maybe I should replace the DOB DateTime field in sql with a date field.

        Comment


          #19
          Re: Calculate age as at January 1st !!!

          Sorry, the age field has the formula not dob

          Comment


            #20
            Re: Calculate age as at January 1st !!!

            Maybe I should replace the DOB DateTime field in sql with a date field.
            date of birth can be defined as date in your sql table definition not necessary to have datetime.
            that is what I suggested in post #17

            if you have date of birth as date not datetime
            then AgeN can be calculated as of January 1st of any given year. then you do all other maths based on AgeN

            also can you post your screencapture image of your grid? (just to see what is involved.)
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            [email protected]
            Skype:[email protected]
            1 914 924 5171

            Comment


              #21
              Re: Calculate age as at January 1st !!!

              Hey Cornelius,

              I think part of the confusion is that you're using Client-side only Immediate validation Javascript. However, I think Govindan believes you are using Server-side validation and is therefore posting XBasic code to calculate age as of Jan 1. Just a mis-communication.

              If you want to stay in Client-side (and you should, if possible 'cause you don't have to make a trip to the server) then you'll need to use Javascript to calc the 'Age As Of'. Have a look at this...

              http://www.youtube.com/watch?v=_K6BQDCpyUU

              If the validation process you're using is not what I've outlined above then post, specifically, what you're using... and where. Although you can see the code I'm using in the video, here it is. I've commented out only that code I didn't need. Most of it is as you posted.

              Code:
              var rn = {grid.object}._selectedRow;
              
              //var AgeN = {grid.object}.getValue('G','AGE',rn);
              
              var DOB = {grid.object}.getValue('G','COMPDOB',rn);
              var CompA = {grid.object}.getValue('G','COMPETITIONA',rn);
              //var RaceType = {grid.object}.getValue('G','SENIORJUNIOR',rn);
              
              var AgeN = calculate_age_as_of(DOB);
              var SOR1MinAgeN = 16;
              
              var CompAMClass1 = {grid.object}.getValue('G','CompAMClass1',rn);
              var CompAMClass1E = {grid.object}.getValue('G','CompAMClass1E',rn);
              
              if(CompA == 'Senior National' && CompAMClass1 == 'OR1' && CompAMClass1E == 'Yes')
              {	
              
              if(AgeN < SOR1MinAgeN)
              {
              return 'Age must be older or equal to 16 for OR1 Class';
              }
              }
              return false;
              Hope that helps. If not... we'll try again.

              Comment


                #22
                Re: Calculate age as at January 1st !!!

                hello

                I just want to point out to you if you already did not know, that after all checking anybody can still insert the record into the database.
                the better way to do will be get all information and use canInsertRecord server side script to catch all those ifs and cancel insertion at that time.
                I can post en example if you want. but I am sure you can do it.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #23
                  Re: Calculate age as at January 1st !!!

                  Damn, you're good !!!

                  Comment


                    #24
                    Re: Calculate age as at January 1st !!!

                    Gandhi,

                    I have tested your code and it works great.

                    Just a question. I might be doing something wrong still as it validates on the year correctly, but it does not seem to take the 1st of January into account.

                    We need to validate the age as at the 1st of January each year to be eligible for the class. MSA [Motorsport South Africa] rules state that the age threshold for ANY class entry must be as on the 1st of January each year.

                    If my birthday is the 2nd of Jan and I turn 16 then, I will be to young for the OR1 class for the rest of the year. If I turn 16 on the 1st or before the 1st, then I can enter the OR1 class.

                    Comment


                      #25
                      Re: Calculate age as at January 1st !!!

                      Originally posted by GGandhi View Post
                      hello

                      I just want to point out to you if you already did not know, that after all checking anybody can still insert the record into the database.
                      the better way to do will be get all information and use canInsertRecord server side script to catch all those ifs and cancel insertion at that time.
                      I can post en example if you want. but I am sure you can do it.
                      Gandhi,
                      Any example will be appreciated.

                      Ps.
                      I read on a thread somewhere you might have visited a friend with a houseboat. Did you go?
                      My daughter is currently in Dallas doing student work and engaging the FBI. She is majoring in Criminology degree studies and has applied with them for acceptance. Are you far from Dallas?

                      Comment


                        #26
                        Re: Calculate age as at January 1st !!!

                        hello

                        1. it is rather difficult to calculate age at the start of the year in sql and javascript but lot easier in alpha.
                        2. you also do not want people able to insert data if there are any errors just like xdialog does.
                        3. you also do not want anyone to update with a wrong data once they entered the correct data earlier.

                        I have created couple of videos to show.
                        if this is not what you want please discard the info.

                        http://screencast.com/t/akdfjxYhCl

                        http://screencast.com/t/t6u1GVmq

                        http://screencast.com/t/JWojoc47yR3J

                        http://screencast.com/t/AEuNGRk3

                        edit: final video
                        http://screencast.com/t/IQcDC4ykaU
                        Last edited by GGandhi; 12-04-2013, 09:46 AM.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        [email protected]
                        Skype:[email protected]
                        1 914 924 5171

                        Comment

                        Working...
                        X