# 4 tier if ..elseif

Hi Scott

I'm having trouble with getting if .. else if to work over 4 tiers

Below is an example

https://dashboard.blaze.today/snippet/PAgEWN0EbMXRICj2c2Sq

Is 3 the limit or is my snippet writing dismal. I have agonised hours over this problem.

George

Hi George,

More than 4 tiers should work.

Could you outline what the expected behavior is compared to the actual behavior with the snippet you've linked to? (e.g. "Select FDR in the first menu, then Father in the second. You should see XX but you actually see YY")

I've taken a look at it and I don't understand the context enough to determine what part looks wrong.

-Scott

Sorry Scott I didn't explain.

the context and content are ok but the tiers do not open up sequentially.

When I make the 1st choice (FDR = first degree relative) vs (SDR = second degree relative), then choices number 2 (to Select the appropriate family member relative) which is the the desired effect. However, menu number 4 also opens which can confuse the user as they have not categorised the selected family member into either under 55 years of age or over 55 (menu or choice number 3).

I could not fix the sequence order to open 1 --> 2 --> 3 --> 4

At present it opens 1 --> 2 & 4 --> 3

Sorry to have bothered you Scott, I finally cracked it - I exchanged the final {else} for {elseif} and it fell in place. Works perfectly and in the correct order.
I left the 2 versions to contrast for your comment and to determine if this is correct?

I had previously asked about the possibility of inserting a past date, and I understand that this is in the future offering, what about a quick way to enter someone's age without typing it in plus a previous age (say age at diagnosis of an illness) and/or number of years illness present? Is this possible?

Perfect, looks like you have it all figured out.

For your follow up, do I understand correctly that you want to calculate some one's current age based on an age an event occurred and the duration since then? If so you could do something like:

Age of diagnosis: {formtext: name=diagnosis; default=50}
Number of years illness present: {formtext: name=duration; default=10}

Current age: {=diagnosis + duration}