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

convert age in months to years,months,days

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

  • jdoyle
    replied
    Re: convert age in months to years,months,days

    The tab order in each example works fine. I never gave it a though that the tab order effected running the code. Learned something the last few days.
    This message board and it's advanced "Certified Alphaholic" are amazing.
    Again thinks again.
    Jim

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    if you think, you may need to change the show_date periodically on the data then you can have same function fire onChange event of that field too.
    you can modify the code for the function to skip calculation if either of the fields is empty. if you do that then you can keep the current tab order.

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    okay I made changes to the form.
    now on change event in on date of birth field. tab order is changed so that the show date is filled in before tha dob is filled in.
    Attached Files

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    because the show_date does not change the onChange event will not fire if attached to that field. you could on the otherhand attach to the dob of the animal field on change event then it should calculate when you enter the dob.

    Leave a comment:


  • jdoyle
    replied
    Re: convert age in months to years,months,days

    Again Mr. Gandhi thank you for your input.
    I have changed the tab order to suit a better flow of data input.
    Changed the show_date so that it defaults to the last entry. When using the application the show _date will stay the same until you start a new set of show data for a different show. By changing to default you are not having to input show_date for every new animal entered. The only thing I can not solve is upon changing the DOB (because of wrong input by user-typo) for an animal already in the data base the code will not recalculate the age. I have tried several different things-never recalculates age.
    Attached latest zip

    Jim
    Attached Files

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    okay
    I did some modifications to the table and the form.
    I changed the yearsold to character field, I changed the animal_age from calculated field to user entered, I removed the button to calculate the age, I removed the event firing the xdialog on canedit event of the show_date. I changed the tab order to suit me, that is not my advice for you to change.

    here are the two videos
    llama1
    http://screencast.com/t/ERbG5NdOdw

    llama2
    http://screencast.com/t/lirp5EeA

    Please understand that I am a novice at this and sometimes may not use the correct terminology.
    work looks very good to me.
    Attached Files
    Last edited by GGandhi; 02-17-2014, 07:22 AM.

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    I will redo your database and send back.
    in the meantime
    take a look at the second video below the code and study the code. I revised earlier after rereading your post.
    you have copied the xdialog method, but I am using function and calling the function from on change event on your show_date field.
    also I will be changing your age_in_years from numeric to character to show the string.
    it will take about 20 minutes or so then I will upload the zipped file.

    Leave a comment:


  • jdoyle
    replied
    Re: convert age in months to years,months,days

    Mr. Gandhi,
    Again thanks for your help. I have implemented the code into my application and it works.
    I am having a little difficulty with making the script run like I would like to have it run.
    Attached is my application.
    Open main menu-open Llamas.
    On input of llama birth date-would like for it to populate the code with startdate (which is "DOB" field) and enddate (which has obtained from "show_date" field ) and then display age in years, month,days.
    This would do the task in one operation as opposed to two as I now have.

    Please understand that I am a novice at this and sometimes may not use the correct terminology.
    Jim
    Attached Files

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    take a look at this:
    I normally do not work on desktop, my comfort level is not that good with desktop. so please bear with me.
    http://screencast.com/t/G8fKAM1dUI
    Code:
    FUNCTION alpha_ageFull2 AS C (dateOfBirth AS D, showDate AS D )
    	
    		if dateOfBirth > showDate then
    		alpha_ageFull2 = "Date of birth is later than the end date!"
    		else
    dim y1 as n
    dim y2 as n
    dim m1 as n
    dim m2 as n
    dim d1 as n
    dim d2 as n
    dim dY as n
    dim dM as n
    dim dD as n
    dim leapYr as l
    
    
    y1 = year(dateOfBirth)
    y2 = year(showDate)
    m1 = month(dateOfBirth)
    m2 = month(showDate)
    d1 = day(dateOfBirth)
    d2 = day(showDate)
    
    select
    	case mod(y2,4)>0
    		leapYr = .f.
    	case mod(y2,400)=0
    		leapYr = .t.
    	case mod(y2,100)=0
    		leapYr = .f.
    	case else
    	 	leapYr = .t.
    end select
    
    
    if ( d2-d1 < 1)
    	select 
    		case m2 = 1
    			d2 = d2+31
    		case m2 = 2
    			if leapYr 
    				d2 = d2+29
    			else	
    			d2 = d2+28
    			end if
    		case m2 = 3
    			d2 = d2+31
    		case m2 = 4
    			d2 = d2+30
    		case m2 = 5
    			d2 = d2+31
    		case m2 = 6
    			d2 = d2+30
    		case m2 = 7
    			d2 = d2+31
    		case m2 = 8
    			d2 = d2+31
    		case m2 = 9
    			d2 = d2+30
    		case m2 = 10
    			d2 = d2+31
    		case m2 = 11
    			d2 = d2+30
    		case m1 = 12
    			d2 = d2+31
    		end select	
    	m2 = m2-1
    	end if
    	if (m2 < m1)
    		y2 = y2-1
    		m2 = m2+12
    		end if
    dY = y2-y1
    dM = m2-m1
    dD = d2-d1
    alpha_ageFull2 = "Age: "+dy+" years " +dM+" months "+dD+" days "
    end if
    
    	
    END FUNCTION
    http://screencast.com/t/e9ZRs2ee
    improved screencast
    corrected the code and the screencast
    Last edited by GGandhi; 02-16-2014, 11:07 AM. Reason: improved screencast

    Leave a comment:


  • jdoyle
    replied
    Re: convert age in months to years,months,days

    First off Thanks Mr.Hubert for your reply.

    Mr. Gandri,
    Your code was exactly what I was looking for. I knew that I had seen on the message board but was unable to find it. Thanks!

    However now upon executing "New Record" (a button on menu for adding a new animal) the dialog box for the year,month pops up.
    Can not get past it to enter information about the animal.
    Can you help?
    Jim

    Leave a comment:


  • GGandhi
    replied
    Re: convert age in months to years,months,days

    I have a post in the code archive forum

    http://msgboard.alphasoftware.com/al...onths-and-days

    see if that is useful.

    Leave a comment:


  • Keith Hubert
    replied
    Re: convert age in months to years,months,days

    Jim,

    This to start you off.

    Age=date()-DOB
    months=age*12

    You will need to make some adjustment between the number of months in the DOB year and number of months to date in the current year.

    Leave a comment:


  • jdoyle
    started a topic convert age in months to years,months,days

    convert age in months to years,months,days

    Use calculation below to calculate age in months on input of birth date in "DOB" field -writes to a field for age in months.
    12*(YEAR(SHOW_DATE)-YEAR(DOB))+MONTH(SHOW_DATE)-MONTH(DOB)+IF(DAY(DOB)>=DAY(SHOW_DATE),1,0)

    Need the age in months converted to years,months,days to be written in another field called "aginyears"
    or
    With input of birth date in DOB field to calclulate age in years,months,days for field "aginyears"

    Any help would be appreciated
    Jim
Working...
X