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

Getting Disgusted

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

    Getting Disgusted

    The book says I can define my very own function!

    Gee.. thats really swell and all... but how do I use the blasted thing... the book is not clear about this at all.

    Specifically, I copied (stole) the code someone posted for determining the age, based on today's date, of a person from their birthdate. I have a calculated field that should display the age... but it doesnt. Matter of fact... it just says "age"...lol

    If I put the function in the action option of the field on the form, which event do I use? Since its a calculated field the cursor never gets to "enter" the field... stumped

    I must need sleep

    #2
    RE: Getting Disgusted

    If you do a search in this forum for

    user defined function

    you should come across a topic titled:

    RE: Count Business Days

    or something very similar. If you read through that discussion, it should answer most of your questions.

    Comment


      #3
      RE: Getting Disgusted

      Here is a easy calculation for birthday
      age = Calculation field
      bod = the date of birth (the name of the field of your birthday field)
      put this in your calculation on your form and call the calculation field age

      if(cyear(System->Date)+right(cdate(Bod),4)>cdate(System->Date),year(System->Date)-year(Bod)-1,year(System->Date)-year(Bod))

      Comment


        #4
        RE: Getting Disgusted

        Jeff,

        Here is how you can create your own function.

        1. Select the code tab
        2. Click the "new" button.
        3. Select "function"
        4. On the function genie that comes up enter the following
        function name - "age"
        Return type - numeric
        In the name column enter "date_birth"
        In the type columd enter "date"

        This is what you will get in the function window:

        function Age as N(Date_Birth as D)

        end function

        Now, cut and paste the following lines between those two lines

        if alltrim(cdate(Date_birth))=""
        age = 0
        exit function
        end if
        years = val(left(cdate(date()),4))-val(left(cdate(Date_Birth),4))
        if val(right(cdate(date()),4))>=val(right(cdate(Date_Birth),4))
        age = years
        else
        age = years - 1
        end if

        Then end result in the window should look like this

        function Age as N(Date_Birth as D)

        if alltrim(cdate(Date_birth))=""
        age = 0
        exit function
        end if
        years = val(left(cdate(date()),4))-val(left(cdate(Date_Birth),4))
        if val(right(cdate(date()),4))>=val(right(cdate(Date_Birth),4))
        age = years
        else
        age = years - 1
        end if

        end function

        Now, how do you use it. You can use it just like a regular A5 function. For instance, you want to find an age of a person. Their date of birth is stored in a field called "DOB" as a date. If you have a calculated field called age that is numeric, the expression for the calculated field would be

        age(dob)

        If dob has no date value, the age returned is 0. Remenber, whatever value you place within the brackets must be a date value and the return value is numeric.

        Jerry


        Comment


          #5
          RE: Getting Disgusted

          Here's what I use for my used defined function called 'Age'.

          function Age as N(Birthday as D)
          ' type your code here

          Age = year(date())-year(YourDateField)
          if val(right(cdate(YourDateField),4)) > val(right(cdate(date()),4))
          age = age - 1
          end if

          end function

          kenn
          TYVM :) kenn

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

          Comment


            #6
            RE: Getting Disgusted

            Alpha 5 v5 now has an age function built in. No need to code.
            Wow- The gods must be watching. Mention something here and it magically is built in to Alpha 5.

            Seriously though this indicates the ease with which Alpha 5v5 can be extended as Selwyn explained at the conference. It becomes trivial (for Selwyn, not for me) to add this sort of thing without recompiling, if there are new addins or functions download em and go.

            Russ

            Comment


              #7
              RE: Getting Disgusted

              Russ,

              This is meant as a compliment to Selwyn. He is his own worst enemy. We could mention stuff to him all day, day after day and he'd keep adding 'em. I've never seen anyone try to please so many.

              Lets see, 7 weeks and a couple days till June 1st, then sometime that month. Wonder what I'd have to do to be one of the first to buy v5??? It's a good thing we don't have to line up outside his door. He'd have to call the riot squad to keep the peace and quiet the clammering!

              kenn
              TYVM :) kenn

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

              Comment


                #8
                RE: Getting Disgusted

                I agree that perhaps it's time to freeze the feature set, but this shows how easy it is to add stuff to A5 without a full recompile and tinkering with C code. I assume he's doing this stuff on his coffee break.

                Russ

                Comment


                  #9
                  RE: Getting Disgusted

                  Ken, remember: A watched pot doesn't boil!
                  Peter
                  AlphaBase Solutions, LLC

                  [email protected]
                  https://www.alphabasesolutions.com


                  Comment


                    #10
                    RE: Getting Disgusted

                    We/I are/am very fortunate that Selwyn has such dedication and commitment to the users. I say 'users' because he could have released v5 some time ago with alot less features. Financially, I think he could have made more by releasing some time ago and then charging for the upgrades.

                    Additionally, I believe Selwyn understands how important "ease of use' really is, not only with v4 but especially with v5. He demonstrated how major tasks can be accomplished so easily. It really puts Alpha5 ahead of Alpha 4 for ease of use and power. Given the nature of Windows, that's quite a feat.

                    For me, A5's ease of use allows me to frequently create a small database for a specific purpose. Add A5's power and I can do much more, more quickly, w/o code than I can do with Access. V5 will only put me in "warp speed".

                    So, to Selwyn I say, Thank you for providing a product that allows me to take my investigative work to new deminsions. I'm able to provide reports which have strong evidentiary value and result in positivie conclusions for the agency.

                    kenn
                    TYVM :) kenn

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

                    Comment


                      #11
                      RE: Getting Disgusted

                      Coffee break? Whats that? Selwyn and the rest of the development team are obviously working very hard to hit the release target and respond to our needs (and the neat "like to have" stuff). I have gotten some emails back from Selwyn that were sent late at night, saturdays, and sundays. Busy guys, but things are changing quickly.

                      The only "problem" I see with A5V5 will be that all of the "neat stuff" many of use have spent hours to develop, like an age function, popup calendars, etc are now included standard. Sure will simplify development, though. Like Ken, I can't wait for the final version.

                      Jerry

                      Comment


                        #12
                        RE: Getting Disgusted

                        Well, none of the suggestions for this worked... but I FIXED IT!

                        I removed the age field.... end of problem... now on to the next problem.

                        Comment


                          #13
                          RE: Getting Disgusted

                          Jeff,

                          Bear with me for a bit. I re-read your post. You stated, "I have a calculated field that should display the age... but it doesnt. Matter of fact... it just says "age"...lol"

                          When a calcualted field displays the name of the calculated field, rather than the result, the calculated field isn't defined correctly.

                          You name the calculated field 'Age'. How did you define it? If you use the Drag/Drop genie and drop a calcualted field on the form you should use the following expression:

                          UDF(DOB field)

                          where UDF is the name of your user defined function and DOB field is the field in the table which stores the person's DOB. That will work

                          Also, you said you solved the problem by removing the Age field. Specifically, what problem was solved? Do you now NOT have a field to show the age?

                          We gave you suggestions about the UDF but failed to realize that the problem is how the calculated field is defined. I don't want to beat this to death but it will work when done properly.

                          kenn
                          TYVM :) kenn

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

                          Comment


                            #14
                            RE: Getting Disgusted

                            Ok.. one more shot at it then its time to move on to some other problem.

                            Here is the code for the Age UDF:

                            function Age as N(Date_Birth as D)

                            if alltrim(cdate(Date_birth))=""
                            age = 0
                            exit function
                            end if
                            years = val(left(cdate(date()),4))-val(left(cdate(Date_Birth),4))
                            if val(right(cdate(date()),4))>=val(right(cdate(Date_Birth),4))
                            age = years
                            else
                            age = years - 1
                            end if

                            end function

                            the calculated field on the form is named age, and its defined as Age(Birthdate)... Birthdate is the table field with the date info.

                            See whats wrong? And does/did Sherry Martin write books on A5? I liked her A4 books.

                            If this were A4 I could do this in my sleep...

                            Comment


                              #15
                              RE: Getting Disgusted

                              Just pasted in your function and it works fine for me. From the interactive editor:

                              ? age({01/22/1950})
                              = 52.000000

                              birthdate = {04/30/1982}
                              ? age(birthdate)
                              = 19.000000


                              Possible conflict with a calculated field "age" calling a function "age()"? Try renaming the calculated field.

                              Verify that your field "birthdate" is a date field? Verify that your field is "birthdate" and not "Date_Birth"?

                              Grasping for straws, I know, but what works on one machine should work on another.
                              There can be only one.

                              Comment

                              Working...
                              X