You need to sign in to do that
Don't have an account?
Sascha Deinert
Date Calender Count
Hi,
Could you help me with the problem below. I got the error "No access to entity: Calendar in row 1, column 8", but I didn't know exactly the error.
Is the following syntax ok?
Thanks for your help, Sascha
Could you help me with the problem below. I got the error "No access to entity: Calendar in row 1, column 8", but I didn't know exactly the error.
Is the following syntax ok?
IF(Calendar.Year(EZR.Beginn_der_HV__c) = This.Year) { Bestandsentwicklung_CY++; }The field Beginn_der_HV__c includes dates. I want to count the Beginn_der_HV__c if the calendar year from this field is like current year, also I need to count the field if the calendar year from this field is like current year - 2.
Thanks for your help, Sascha
public class testfor6_c { private Id accId {get; set;} public testfor6_c(ApexPages.StandardController stdcontroller) { accId = stdcontroller.getRecord().Id; Bestandsentwicklung_CY = 0; Bestandsentwicklung_CY_2 = 0; getEZRen(); } public Integer Bestandsentwicklung_CY {get; set;} public Integer Bestandsentwicklung_CY_2 {get; set;} public void getEZRen() { List<Einzelrisiko__c> EZRList = [SELECT Beginn_der_HV__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId]; FOR (Einzelrisiko__c EZR : EZRList) { IF(Calendar.Year(EZR.Beginn_der_HV__c) = This.Year) { Bestandsentwicklung_CY++; } IF(Calendar.Year(EZR.Beginn_der_HV__c) = This.Year-2) { Bestandsentwicklung_CY_2++; } } } }
there is a little error here, sorry : you need to use "=="
change : to : Hope this helps
Gil
Question Solved ? Please mark as the best answer to help other users !
All Answers
If you want to get the yar part of a date or datetime field, just use : Hope this helps
Gil
Question Solved ? Please mark as the best answer to help other users !
Because I need in front of the field "Beginn_der_HV__c" the listname EZR in the for loop.
Just create local variable thisYear and put it before for loop:
and change This.Year in your code to thisYear.Gil
Question Solved ? Please mark as the best answer to help other users !
Expression cannot be assigned
there is a little error here, sorry : you need to use "=="
change : to : Hope this helps
Gil
Question Solved ? Please mark as the best answer to help other users !