Class 未知属性“Integer.count_18”可视力
我用谷歌搜索了很多,但我没有找到解决我错误的方法 我得到错误未知属性“Integer.count\u18” 我希望你能帮助我 谢谢, 皮克斯 可视力页面 阶级 公共类Gruppenvertrag_c9{Class 未知属性“Integer.count_18”可视力,class,controller,salesforce,visualforce,Class,Controller,Salesforce,Visualforce,我用谷歌搜索了很多,但我没有找到解决我错误的方法 我得到错误未知属性“Integer.count\u18” 我希望你能帮助我 谢谢, 皮克斯 可视力页面 阶级 公共类Gruppenvertrag_c9{ private Id accId {get; set;} public Gruppenvertrag_c9(ApexPages.StandardController stdcontroller) { accId = stdcontroller.getRecord().Id;
private Id accId {get; set;}
public Gruppenvertrag_c9(ApexPages.StandardController stdcontroller) {
accId = stdcontroller.getRecord().Id;
}
public Integer getEinzelrisiko() {
//List<Einzelrisiko__c> listEZR = [SELECT COUNT() FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId];
List<Einzelrisiko__c> listEZR = [SELECT Alter__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId];
Integer Count_u18 = 0;
Integer Count_1822 = 0;
Integer Count_2227 = 0;
Integer Count_2732 = 0;
Integer Count_3237 = 0;
Integer Count_3742 = 0;
Integer Count_4247 = 0;
Integer Count_4752 = 0;
Integer Count_5257 = 0;
Integer Count_g57 = 0;
FOR(Einzelrisiko__c ein : listEZR) {
IF(ein.Alter__c < 18) { Count_u18++; }
IF(ein.Alter__c >18 && ein.Alter__c <=22) { Count_1822++; }
IF(ein.Alter__c >22 && ein.Alter__c <=27) { Count_2227++; }
IF(ein.Alter__c >27 && ein.Alter__c <=32) { Count_2732++; }
IF(ein.Alter__c >32 && ein.Alter__c <=37) { Count_3237++; }
IF(ein.Alter__c >37 && ein.Alter__c <=42) { Count_3742++; }
IF(ein.Alter__c >42 && ein.Alter__c <=47) { Count_4247++; }
IF(ein.Alter__c >47 && ein.Alter__c <=52) { Count_4752++; }
IF(ein.Alter__c >52 && ein.Alter__c <=57) { Count_5257++; }
IF(ein.Alter__c >57) { Count_g57++; }
}
return Count_u18;
return Count_1822;
return Count_2227;
return Count_2732;
return Count_3237;
return Count_3742;
return Count_4247;
return Count_4752;
return Count_5257;
return Count_g57;
}
}getEinzelrisiko方法的问题。此方法返回整数,PageblockTable值属性的类型应为List
我已经更改了Visualforce页面,请检查这个
视觉力:
希望它能帮助您我已将查询分为两个查询,并对其进行了测试。 但是,现在我得到了一个查询列表,但我只想要一个查询计数。可以再次查看代码 谢谢, 萨沙
谢谢你的支持。但我仍然得到一个未知属性“Gruppenvertrag_c9.CountClass.Count_u18”的错误。谢谢,peXTry将CountClass属性设置为public并检查..我已经编辑了答案。嘿,非常感谢,但现在我得到的visualforce错误集合大小1.172超过了最大大小1.000。通过筛选条件限制SOQL查询大小..如果适用,请将此答案标记为OK。您是否有其他方法来处理此查询。首先,我对所有年龄段的人都进行了查询,我认为如果我按照上面的方式进行查询,速度会慢一些。我可以用数组进行查询吗?
private Id accId {get; set;}
public Gruppenvertrag_c9(ApexPages.StandardController stdcontroller) {
accId = stdcontroller.getRecord().Id;
}
public Integer getEinzelrisiko() {
//List<Einzelrisiko__c> listEZR = [SELECT COUNT() FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId];
List<Einzelrisiko__c> listEZR = [SELECT Alter__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId];
Integer Count_u18 = 0;
Integer Count_1822 = 0;
Integer Count_2227 = 0;
Integer Count_2732 = 0;
Integer Count_3237 = 0;
Integer Count_3742 = 0;
Integer Count_4247 = 0;
Integer Count_4752 = 0;
Integer Count_5257 = 0;
Integer Count_g57 = 0;
FOR(Einzelrisiko__c ein : listEZR) {
IF(ein.Alter__c < 18) { Count_u18++; }
IF(ein.Alter__c >18 && ein.Alter__c <=22) { Count_1822++; }
IF(ein.Alter__c >22 && ein.Alter__c <=27) { Count_2227++; }
IF(ein.Alter__c >27 && ein.Alter__c <=32) { Count_2732++; }
IF(ein.Alter__c >32 && ein.Alter__c <=37) { Count_3237++; }
IF(ein.Alter__c >37 && ein.Alter__c <=42) { Count_3742++; }
IF(ein.Alter__c >42 && ein.Alter__c <=47) { Count_4247++; }
IF(ein.Alter__c >47 && ein.Alter__c <=52) { Count_4752++; }
IF(ein.Alter__c >52 && ein.Alter__c <=57) { Count_5257++; }
IF(ein.Alter__c >57) { Count_g57++; }
}
return Count_u18;
return Count_1822;
return Count_2227;
return Count_2732;
return Count_3237;
return Count_3742;
return Count_4247;
return Count_4752;
return Count_5257;
return Count_g57;
}
<apex:page standardController="Account" extensions="Gruppenvertrag_c9">
<apex:form >
<apex:pageBlock Title="Long ID lautet">
<apex:outputText value="{!Account.ID}"/>
</apex:pageBlock>
<apex:pageBlock title="Count of Ages">
<apex:pageBlockTable value="{!CountList}" var="EZR">`//Changed Value Attribute.`
<apex:column value="{!EZR.Count_u18}"/>
<apex:column value="{!EZR.Count_1822}"/>
<apex:column value="{!EZR.Count_2227}"/>
<apex:column value="{!EZR.Count_2732}"/>
<apex:column value="{!EZR.Count_3237}"/>
<apex:column value="{!EZR.Count_3742}"/>
<apex:column value="{!EZR.Count_4247}"/>
<apex:column value="{!EZR.Count_4752}"/>
<apex:column value="{!EZR.Count_5257}"/>
<apex:column value="{!EZR.Count_g57}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Gruppenvertrag_c9 {
private Id accId {get; set;}
public List<CountClass> CountList {get;set;} //this list contains all the values and binded to Pageblocktable
public Gruppenvertrag_c9(ApexPages.StandardController stdcontroller) {
accId = stdcontroller.getRecord().Id;
getEinzelrisiko();//called in the constructor.
}
public void getEinzelrisiko() {
//List<Einzelrisiko__c> listEZR = [SELECT COUNT() FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId];
List<Einzelrisiko__c> listEZR = [SELECT Alter__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId];
CountList = new List<CountClass>();
FOR(Einzelrisiko__c ein : listEZR) {
CountClass cc = new CountClass();
IF(ein.Alter__c < 18) { cc.Count_u18++; }
IF(ein.Alter__c >18 && ein.Alter__c <=22) { cc.Count_1822++; }
IF(ein.Alter__c >22 && ein.Alter__c <=27) { cc.Count_2227++; }
IF(ein.Alter__c >27 && ein.Alter__c <=32) { cc.Count_2732++; }
IF(ein.Alter__c >32 && ein.Alter__c <=37) { cc.Count_3237++; }
IF(ein.Alter__c >37 && ein.Alter__c <=42) { cc.Count_3742++; }
IF(ein.Alter__c >42 && ein.Alter__c <=47) { cc.Count_4247++; }
IF(ein.Alter__c >47 && ein.Alter__c <=52) { cc.Count_4752++; }
IF(ein.Alter__c >52 && ein.Alter__c <=57) { cc.Count_5257++; }
IF(ein.Alter__c >57) { cc.Count_g57++; }
CountList.add(cc);//adding each record to the list
}
}
public class CountClass
{
public Integer Count_u18 {get;set;}
public Integer Count_1822 {get;set;}
public Integer Count_2227 {get;set;}
public Integer Count_2732 {get;set;}
public Integer Count_3237 {get;set;}
public Integer Count_3742 {get;set;}
public Integer Count_4247 {get;set;}
public Integer Count_4752 {get;set;}
public Integer Count_5257 {get;set;}
public Integer Count_g57 {get;set;}
public CountClass()
{
Count_u18 = 0;
Count_1822 = 0;
Count_2227 = 0;
Count_2732 = 0;
Count_3237 = 0;
Count_3742 = 0;
Count_4247 = 0;
Count_4752 = 0;
Count_5257 = 0;
Count_g57 = 0;
}
}
}
<apex:page standardController="Account" extensions="Gruppenvertrag_c55,Gruppenvertrag_c56">
<apex:form >
<apex:pageBlock Title="Long ID lautet">
<apex:outputText value="{!Account.ID}"/>
</apex:pageBlock>
<apex:pageBlock title="Count of Ages">
<apex:pageBlockTable value="{!CountList2}" var="EZR2">
<apex:column value="{!EZR2.Count_u18}"/>
<apex:column value="{!EZR2.Count_1822}"/>
<apex:column value="{!EZR2.Count_2227}"/>
<apex:column value="{!EZR2.Count_2732}"/>
<apex:column value="{!EZR2.Count_3237}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Count of Ages">
<apex:pageBlockTable value="{!CountList}" var="EZR">
<apex:column value="{!EZR.Count_3742}"/>
<apex:column value="{!EZR.Count_4247}"/>
<apex:column value="{!EZR.Count_4752}"/>
<apex:column value="{!EZR.Count_5257}"/>
<apex:column value="{!EZR.Count_g57}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Gruppenvertrag_c55 {
private Id accId {get; set;}
public List<CountClass> CountList {get;set;} //this list contains all the values and binded to Pageblocktable
public Gruppenvertrag_c55(ApexPages.StandardController stdcontroller) {
accId = stdcontroller.getRecord().Id;
getEinzelrisiko();//called in the constructor.
}
public void getEinzelrisiko() {
List<Einzelrisiko__c> listEZR = [SELECT Alter__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId AND Alter__c >=42];
CountList = new List<CountClass>();
FOR(Einzelrisiko__c ein : listEZR) {
CountClass cc = new CountClass();
IF(ein.Alter__c >37 && ein.Alter__c <=42) { cc.Count_3742++; }
IF(ein.Alter__c >42 && ein.Alter__c <=47) { cc.Count_4247++; }
IF(ein.Alter__c >47 && ein.Alter__c <=52) { cc.Count_4752++; }
IF(ein.Alter__c >52 && ein.Alter__c <=57) { cc.Count_5257++; }
IF(ein.Alter__c >57) { cc.Count_g57++; }
CountList.add(cc);//adding each record to the list
}
}
public class CountClass
{
public Integer Count_3742 {get;set;}
public Integer Count_4247 {get;set;}
public Integer Count_4752 {get;set;}
public Integer Count_5257 {get;set;}
public Integer Count_g57 {get;set;}
public CountClass()
{
Count_3742 = 0;
Count_4247 = 0;
Count_4752 = 0;
Count_5257 = 0;
Count_g57 = 0;
}
}
}