Age calculation between and within forms

Viewing 3 reply threads
  • Author
    Posts
  • March 18, 2019 at 8:00 PM #34053

    Simon
    Participant

    Hi Bredan,

    Firstly, I want to calculate the age a patient was when they had a scan. I manually enter in their DOB as a date, and the date-of-scan as a date. Both of these fields are in the same form. How do I make a new field which will automatically calculated the patients age in years as a new field ‘Age at scan”?

    Secondly, I want to calculate a how old a patient was when they had a particular procedure. I have one primary form with patient name, DOB, ID number etc, and a secondary linked form for the procedure which has a procedure date. Each patient can have multiple procedures and thus procedure dates. For each procedure I’d like a field showing the patient’s age at that particular procedure, using the procedure date field, and their DOB from the primary form. Is there a way to do this??

    Cheers,
    Simon

    March 18, 2019 at 11:34 PM #34055

    Brendan
    Keymaster

    Hi Simon,

    Add a Calculation field and use the formula:

    YYMM(DOB; DateOfScan)

    That’ll display how many years and months there are between DOB and DateOfScan. Set the Result Type to Text for that one.

    Or you can use:

    YEARS(DOB; DateOfScan)

    That’ll return the number of years between the dates. It returns a Number.

    For the second calculation, what type of Link to Form field do you use from the Patient form to the Procedure form? If it’s a One to Many, then you can add a Calculation field to your Procedure form and reference the DOB from the parent Patient form within the formula.

    E.g.

    YEARS(Patient::DOB; DateOfProcedure)

    When you double-click on parent field on the formula editor, Tap Forms will automatically put in the proper reference for you. If you end up getting something like COUNT::Patient::DOB then that means you don’t have a One to Many Link Type and that won’t work. And that’s because the Procedure record could have multiple parent Patient records.

    Thanks!

    Brendan

    March 19, 2019 at 4:27 AM #34059

    Simon
    Participant

    Thank you Brendan,
    Both of your suggestions worked well!
    Thank you :)
    You have made an amazing App!

    March 19, 2019 at 2:02 PM #34063

    Brendan
    Keymaster

    Excellent!

    I’m glad that worked for you.

Viewing 3 reply threads

You must be logged in to reply to this topic.