我尝试计算两个值。 但我没有得到价值。 我想补充价值Altersstruktur_u18和Altersstruktur_1822。在将来我也需要相同但是为了分裂。
你能帮帮我吗?public class testfor3_c {
private Id accId {get; set;}
public testfor3_c(ApexPages.StandardController stdcontroller) {
accId = stdcontroller.getRecord().Id;
Altersstruktur_u18 = 0;
Altersstruktur_1822 = 0;
getEZRen();
}
public Integer Altersstruktur_u18 {get; set;} // variable for people < 18
public Integer Altersstruktur_1822 {get; set;} // variable for people >= 18 AND <= 22
public Integer Sum_u18_1822 {get; set;}
}
public void getEZRen() {
List<Einzelrisiko__c> EZRList = [SELECT Alter__c, Jahresbeitrag__c, Alter_bei_Vertragsbeginn__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId]; // create List EZRList with the information Alter__c of all people
FOR (Einzelrisiko__c EZR : EZRList) { // Loop thru all people
IF(EZR.Alter__c < 18) { Altersstruktur_u18++; } // if Alter__c < 18 variable Altersstruktur_u18 increase
IF(EZR.Alter__c >= 18 && EZR.Alter__c <= 22) { Altersstruktur_1822++; } // if Alter__c >= 18 AND <= 22 variable Altersstruktur_1822 increase
}
Integer Sum_u18_1822 = (Altersstruktur_u18 + Altersstruktur_1822);
}
}
提前致谢, PEX
答案 0 :(得分:0)
我解决了。我删除了最后一种语法
的类型整数Sum_u18_1822 = (Altersstruktur_u18 + Altersstruktur_1822);