How to get vaccination status with validation check on certain criteria?

Based on Age

  1. All (if all vaccine upto the age is taken)
  2. Partial (if any vaccines are missing as per his age)
  3. Unvaccinated (not a single vaccine is taken as per his age)
  4. Potential Zero Dose (if only Penta vaccine is missing)
    output should be only one option.
    For example under UIP schedule, 10 weeks
    The vaccine should be taken:
    OPV0
    HEPB
    BCG
    OPV1
    PENTA1
    RVV1
    PCV1
    IPV1
    OPV2
    PENTA2
    RVV2
    The problem is Partial vaccination is not getting executed its overlap with other options.
    if(${Age} < 6, if(${calculation_002} = 1 and selected(${Vaccination_Age}, 'All'), 'All', if(${calculation_002} = 0 and selected(${Vaccination_Age}, 'Unvaccinated'), 'Unvaccinated', '') ), if(${Age} >= 6 and ${Age} < 10, if(${calculation_002} = 1 and ${calculation_003} = 1 and ${calculation_004} = 1 and ${calculation_005} = 1 and ${calculation_006} = 1 and ${calculation_007} = 1 and selected(${Vaccination_Age}, 'All'), 'All', if(${calculation_002} = 0 and ${calculation_003} = 0 and ${calculation_004} = 0 and ${calculation_005} = 0 and ${calculation_006} = 0 and ${calculation_007} = 0 and selected(${Vaccination_Age}, 'Unvaccinated'), 'Unvaccinated', if(${calculation_002} + ${calculation_003} + ${calculation_004} + ${calculation_005} + ${calculation_006} + ${calculation_007} < 6 and ${calculation_002} + ${calculation_003} + ${calculation_004} + ${calculation_005} + ${calculation_006} + ${calculation_007} >= 1 and selected(${Vaccination_Age}, 'Partial'), 'Partial', '') ) ) ) )
    this one not executed

Hi @Raju_Kumar,

It would have been more helpfull if more details and deeper explanation were provided by you. I am assuming ${calculation_..} variables referenced in the long expression are storing vaccination status for a particular vaccine.
I suggest, to fix the error, you rethink your logic properly and debug your expression.

To help you, I have written your expression in a clean, properly indented and easy to read format.

if(${Age} < 6, 
    if(${calculation_002} = 1 and selected(${Vaccination_Age}, 'All'), 
        'All', 
        if(${calculation_002} = 0 and selected(${Vaccination_Age}, 'Unvaccinated'), 
            'Unvaccinated', 
            ''
        ) 
    ), 
    if(${Age} >= 6 and ${Age} < 10, 
        if(${calculation_002} = 1 and ${calculation_003} = 1 and ${calculation_004} = 1 and ${calculation_005} = 1 and ${calculation_006} = 1 and ${calculation_007} = 1 and selected(${Vaccination_Age}, 'All'), 
            'All', 
            if(${calculation_002} = 0 and ${calculation_003} = 0 and ${calculation_004} = 0 and ${calculation_005} = 0 and ${calculation_006} = 0 and ${calculation_007} = 0 and selected(${Vaccination_Age}, 'Unvaccinated'), 
                'Unvaccinated', 
                if(${calculation_002} + ${calculation_003} + ${calculation_004} + ${calculation_005} + ${calculation_006} + ${calculation_007} < 6 and ${calculation_002} + ${calculation_003} + ${calculation_004} + ${calculation_005} + ${calculation_006} + ${calculation_007} >= 1 and selected(${Vaccination_Age}, 'Partial'), 
                    'Partial', 
                    ''
                ) 
            ) 
        ) 
    ) 
)

Another approach I suggest is;

Try to create 2 sets of calculate variable, one set of three variables for the cases where age is less than 6 years and other set of 3 variables for age of 6 to 10 years.

For example, you can create following calculate vars:
'all_vacLT6', 'un_vacLT6', 'part_vacLT6' -- [ put (${Age}<6) in 'relevance' column for these variables]

'all_vac6to10','un_vac6to10', 'part_vac6to10' -- [ put (${Age} >= 6 and ${Age} < 10) in 'relevance' column for these variables]

'all_vacLT6' will be 1 if Age is <6Yr. and all vaccine required as per age are taken, and 0 otherwise. Write expression in calculate column accordingly.

Similarly, you should write expressions for each condition you want to check for determining vaccination status.

In the end you can check which one of the six variable is equal to 1 by creating one more calculate variable which will store the final calculated status category text ('All' or 'Partial' or 'Unvaccinated').