Tuesday, October 7, 2025

UnionBranchNumber and the magic of unions in X++

IF you check out the view HCMCommplensationPlan, you will notice there is a method called plan type which is a view method

public class HcmCompensationPlan extends common
{
    public static str planType(int _unionBranchNumber)
    {
        HrmCompPlanType planType;
        switch (_unionBranchNumber)
        {
            case 1:
                planType = HrmCompPlanType::Fixed;
                break;
            case 2:
                planType = HrmCompPlanType::Variable;
                break;
        }
        return SysComputedColumn::returnLiteral(planType);
    }
}

The unionBranchNumber parameter here is basically the number of the datasource in the union join. 


The parameter automatically pics the first datasource as case 1 and the second datasource as case 2. This threw me off as I have not seen any documentation on this, but if you find some, do share.