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

Age function

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

    Age function

    New newbe Age function
    Ok, I know you all will be gawfawed at my ignorance I have very little experience working with computer languages such as basic. I have been digging through all of the examples and tutorials but evidently what I am accustomed to in Lotus Approach is different here or I have missed something.

    Fighting the Learning Curve.

    I want to use data input into fields by the user to be processed and show up to be stored in another field using a function. (This is the fundamental aspect of programming data bases.)

    Approach will let you reference the field inside the function and the field you want the data
    to show up in. I don't see how to do that here. It looks like I have to make variables to get the info into the expressions or functions. I don't know.

    So I have Three fields and they are type-in-fields on the form they reflect the respective fields in the table. I have a Form_date field (Date) and a Birth_date field (Date) I made these two fields smart calendar fields. I also have the Age_as_of_form_date field (Numeric) or should this be a text or a date field?

    The user has to supply the form date and the birth date. Now I want the age of the person to show up in the Age_as_of_form_date field. Seems simple enough and Alpha's help files give examples of this kind of thing using dates over and over but basically they show the info already written into the function. I am interested in making it dynamic. I don't see how to get the info from one field to another. I found the Age Function.
    (I don't know of any programming language that has an age function.) So great! The syntax I see in the code editor on the actions script is age(d dob [,d asofdate ]). Age() is supposed to return a numeric value but the input I have is date value. So do I have to change the date value to numeric to use the function? How do I do this? I have tried to make variables but I get either invalid or incomplete expression errors or that it doesn't evaluate to numeric.
    A bit lost.

    Any insight will be truly appreciated
    Thank you George R. Kenney

    #2
    RE: Age function

    "" Now I want the age of the person to show up in the Age_as_of_form_date field""

    George,

    Once you have the date of birth in the table, there's usually no reason to store the current age in a table field. If you wanted to show the current age on a form, just define a form level calculated field in your form layout, using an expression that will compute the current age based on the current record's date of birth. The same thing can be done in report layouts. Doing it this way you don't have the overhead of keeping a record in the table up to date, but your users can see the actual age even if they only run the report or check the record once a year.

    -- tom

    Comment


      #3
      RE: Age function

      Hi George:

      Here is how I use the age function in my application. Just use the birthdate field with the age function:

      age(Datofbirth)

      I use this as the syntax for a calculated field. If for some reason you want to store the age in a table field, you could use XBasic or the Action Scripting to set the value of the field equal to that expression above.

      I have had to convert a number of applications from Lotus Approach to Alpha, and keep in mind, the Action Scripting tool in Alpha is far more robust than the Macro tool in Approach. It is a great way to learn how certain functions should be written in XBasic.

      My experience with converting macros to LotusScript in Approach is that Approach often leaves you with scripts that have errors. The macro to script translator fails to convert all steps of a complex macro properly. This is not the case with Alpha 5. Any "Action Script" (Macro) that you convert to XBasic will be a clean conversion and will work the same as script as it did as a Macro.

      Rich Kerr
      Rich Kerr
      http://www.richkerr.com
      [email protected]

      Comment


        #4
        RE: Age function

        Thank you for your quick response on this
        I will need to store the age of the client as I use the database for document creation specifically I create wills via the WordPerfect data tool merge. This means I also have to change numeric and date data to text data because the tool is really only some kind of text importer. But anyway my real goal was to learn how to manipulate the fields and the functions as I have to do a lot of it to get the results I want. I have to change words based on gender plulality or possessive state and make assignments to family members storing many names all of which need to have all kinds of personal and financial data ready to be used in a form. The goal is to automate form production and without WordPerfect I don't think it could be done I mean in some documents you have to place the same address at the beginning and then at the end. Thats easy to do in a data base but tricky in a merge. I have yet to explore the Letter capability of Alpha But mind you I have done all this in Aproach its just that I kept running into as you said the overhead the limits 255 fields and record size of 4,096 bytes. I don't think that Approach is ever going to be really improved or be used on the internet as a database I mean from just what I have seen so far there isn't anyway to compare the products.

        Comment


          #5
          RE: Age function

          Thank you Rich
          I'll try that. So I need to make a calculated field and put the formula in it referencing the field on the other side of the equal sign such as
          Age_As_Of_Field_date=Age(birth_date)

          Its true the so called macro translator was never recomended by anyone. I think that was the last gasp at giving Approach a new tool. Ibm pretty much back shelved lotus products and I started looking around when they came up with this Pay for Service upgrades. But mostly I started looking for a data base that could have more than 255 fields in a record which seems to be the norm in the database industry.

          Comment


            #6
            RE: Age function

            George,

            Beware that upon setting it up as a calculated field in your table, this age field will reflect the age as of the date that the record was last saved or the date when a "recalculate field rules" operation was performed (whichever is later).

            For example, if you entered a record a few years ago and have neither resaved that record nor run the "recalculate field rules" operation, the age field will be understated by two years. That is the advantage of having it calculated on the fly as Tom suggested. Not having used the WordPerfect data merge tool myself, I'm not sure about the extent to which the field can be avoided as such.

            Steve

            Comment


              #7
              RE: Age function

              George:

              When you start setting up the calculated field in Alpha, you enter that formula in the expression box in the dialog box which appears.

              It is similar to the field definition process in Approach, where you define a field as calculated, and you enter the formala/expression in the box below the list of fields in a table... well in Alpha, you can display the Drag/Drop list, and at the top of the list, one of the options is New Calculated field (or something close to that). When you drag that item onto your form, you will be prompted to enter the expression for the calculated field.

              I used Lotus Approach for quite a while, and was disappointed when IBM announced they would no longer support the product. I have found though, that Alpha is far more robust, and the Action Scripting tool provides a huge amount of functionality... the XBasic language is also far more robust than Lotus Script. There are ,amu useful functions in XBasic that just don't exist in Lotus Script.

              Rich
              Rich Kerr
              http://www.richkerr.com
              [email protected]

              Comment


                #8
                RE: Age function

                Ok I'm making progress because now I can get the age. But
                for the life of me I can't seem to get the formula of the
                expresson to work the way they say it will in code editor
                Age( d dob[,d asofdate])

                I mean the problem is that I believe the date here is set
                to the system date so next year the dead person will be
                a year older if someone taps on the field on the form but what I want is this to work the way they say it does. I want to set the end date being the date I started the will or the form date. Once I figured out how to put the name of the field in the formula I could get the equation to work the way you have told me in the code editor. But every time I start to insert the second half or what I think is the second half of the equation it tells me its invalid. I mean am I reading this syntax wrong or what?
                Thanks Again I am start to see how it goes here.

                Comment


                  #9
                  RE: Age function

                  Thanks Steve
                  That is the problem I thought if the age function is tied to the system date I want it tied to the form date as
                  dead people don't grow older. There are other ways to do this as Alpha has a whole different means of accomplishing things. The formula in the code editor supposedly will allow me to do exactly what I want to do which is set the birth date and the end date Age( d dob[,d asofdate]) the problem is when I slip the name of the field in there it goes Age(birth_date) perfect I get the age. But if I add
                  Age(birth_date[,form_date]) it tells me its invalid so I must have a syntax error or the formula doesn't work that way.

                  Comment


                    #10
                    RE: Age function

                    George,

                    I have no problems using the second parameter:
                    Code:
                    dim form_date as D
                    dim dob as D
                    dob = {04/29/51}
                    form_date = {01/01/2003}
                    
                    ?age(dob)
                    = 54.000000
                    
                    ?age(dob,form_date)
                    = 51.000000
                    Are both of your parameters date type? If, say, your form date field were a character field you would have to convert it to a date before using it in the age() function.

                    Steve

                    Comment


                      #11
                      RE: Age function

                      George,

                      I have no problems using the second parameter:

                      dim form_date as D
                      dim dob as D
                      dob = {04/29/51}
                      form_date = {01/01/2003}

                      ?age(dob)
                      = 54.000000

                      ?age(dob,form_date)
                      = 51.000000

                      Are both of your parameters date type? If, say, your form date field were a character field you would have to convert it to a date before using it in the age() function.

                      Steve

                      Comment


                        #12
                        RE: Age function

                        George:
                        "Age() is supposed to return a numeric value but the input I have is date value. So do I have to change the date value to numeric to use the function?"

                        The input and output of a function do not have to be of the same type. That goes for any function.

                        "I will need to store the age of the client as I use the database for document creation "
                        You do not need to store any calc fields in order to be able to use it later.

                        "I create wills via the WordPerfect data tool merge"
                        That's fine, but might not be necessary as you could do the same using reports or letter, which is a better way to go.

                        "so next year the dead person will be a year older"
                        Yes and No. :
                        Yes: Age() function takes two parameters: starting date (DOB) and ending date. If you do not enter the ending date, the function will calculate the age as of today's date.
                        No: the dead person will not be a year older if you enter the ending date in your age() function.

                        Gabe

                        Comment


                          #13
                          RE: Age function

                          Thanks Gabe for you reply
                          I keep trying to input the second parameter but it doesn't seem to work the syntax they give me in the code editor is Age(d dob[,d AsOfDate]) so what I keep doing is I select the function then I insert the field name and type in the bracket [ comma and insert the second field name the last bracket and closure parenthesis. At the bottom of the code editor it is telling me invalid or incomplete expression. when I go ahead it tells me it doesn't return a numeric value. If I eliminate all but
                          Age(Birth_Date) I get the age but I think it is tied as you pointed out to the system date. I suppose I don't understand the syntax of the second paramater.
                          I haven't had a chance to see what I can do with the forms
                          in Alpha 5 yet but I hope there is no limit to the size of the letters as some of wills can be 40 to 100 pages.
                          The lawyers are very paticular about the letter style etc. so I can see what happens but I was pleased to find a perfect discription of how to run the WordPerfect Data tool
                          in Alpha five under Letters. Not even wordperfect has such
                          a clear description.

                          Comment


                            #14
                            RE: Age function

                            Steve
                            ah never used this method I just used the code editor but I ll try it out
                            thanks

                            Comment


                              #15
                              RE: Age function

                              George,

                              You do NOT type in the bracket ("["). The bracket is there to let you know that it is an optional parameter (having a default value in case you do not include it).

                              Steve

                              Comment

                              Working...
                              X